Bug 4497 - getdents gives empty/random result upon signal
Summary: getdents gives empty/random result upon signal
Status: RESOLVED CODE_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: Samba/SMB (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: fs_samba-smb
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-14 21:52 UTC by Stian Skjelstad
Modified: 2006-01-21 23:13 UTC (History)
1 user (show)

See Also:
Kernel Version: 2.6.9
Subsystem:
Regression: ---
Bisected commit-id:


Attachments
smbfs-readdir-vs-signal-fix (952 bytes, text/plain)
2005-10-25 15:56 UTC, Andrew Morton
Details

Description Stian Skjelstad 2005-04-14 21:52:00 UTC
Distribution: gentoo 2005.0
Hardware Environment: x86
Software Environment: glibc
Problem Description:

If a signal interrupts getdents (atleast with smbfs), the result is often empty,
here is output from strace.

open("/home/stian/server-audio/a/1/",
O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 11
fstat64(11, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
fcntl64(11, F_SETFD, FD_CLOEXEC)        = 0
getdents(11, 0x832bafc, 4096)           = ? ERESTARTSYS (To be restarted)
--- SIGALRM (Alarm clock) @ 0 (0) ---
gettimeofday({1113539488, 457225}, NULL) = 0
ioctl(10, SNDCTL_DSP_GETODELAY or SNDCTL_DSP_PROFILE, 0xbfffc760) = 0
ioctl(10, SNDCTL_DSP_GETOSPACE, 0xbfffc764) = 0
write(10, "\347\377{\341\'\375\240\3405\372\6\341\210\367\365\342"..., 2904) = 2904
getitimer(ITIMER_REAL, {it_interval={0, 14997}, it_value={0, 13997}}) = 0
gettimeofday({1113539488, 458598}, NULL) = 0
sigreturn()                             = ? (mask now [])
getdents(11, /* 0 entries */, 4096)     = 0


Steps to reproduce:
setitimer() and try to use diropen()/readdir() alot until it is interrupted by a
SIGALRM. Happens alot if the source-filesystem is smbfs atleast.
Comment 1 Andrew Morton 2005-10-25 15:56:50 UTC
Created attachment 6389 [details]
smbfs-readdir-vs-signal-fix

Could you please test this putative fix?
Comment 2 Andrew Morton 2006-01-16 01:22:17 UTC
ping?
Comment 3 Stian Skjelstad 2006-01-16 02:06:25 UTC
I'm sorry, been a bit busy and I forgot about it. I'll regression-tests on it
tonight after work.
Comment 4 Stian Skjelstad 2006-01-17 02:20:41 UTC
I patched it in last night (against vanilla 2.6.15), and tested it this morning
with localhost as server. Problem did not occure a single time with this patch
in. Did get some other non-related messages in my syslog:

Jan 17 11:25:43 gentoo-2 smb_proc_readdir_long: error=-512, breaking
Jan 17 11:25:43 gentoo-2 smb_proc_readdir_long: error=-512, breaking
Jan 17 11:25:43 gentoo-2 smb_proc_readdir_long: error=-512, breaking

Everything seems to work well now. I'll try to remove patch again to night to
see if problem re-occures with 2.6.15 vanilla.

Project I'm testing it with is Open Cubic Player, as it uses a SIGALRM for
background scheduling of sound.
Comment 5 Andrew Morton 2006-01-21 23:13:55 UTC
Great, thanks.   I'll merge it.

Note You need to log in before you can comment on or make changes to this bug.