summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-09-03 07:40:48 -0700
committerJeremy Allison <jra@samba.org>2009-09-03 07:40:48 -0700
commitbdc7bdb0d3e02d04477906dbda8995bc5789ce22 (patch)
treee20884ea6a241c8dfdc96298ef712687442c4fd6 /source3
parentc97698e762b1ea8d7133f04ae822225676a6f135 (diff)
downloadsamba-bdc7bdb0d3e02d04477906dbda8995bc5789ce22.tar.gz
samba-bdc7bdb0d3e02d04477906dbda8995bc5789ce22.tar.bz2
samba-bdc7bdb0d3e02d04477906dbda8995bc5789ce22.zip
Hopefully last part of the fix for bug 6651 - smbd SIGSEGV when breaking oplocks.
This one is subtle. There is a race condition where a signal can be queued for oplock break, and then the file can be closed by the client before the signal can be processed. Currently if this occurs we panic (we can't match an incoming signal fd with a fsp pointer). Simply log the error (at debug level 10 right now, might be too much) and then return without processing the break request. It looks like there is another race condition with this fix, but here's why it won't happen. If the signal was pending (caused by a kernel oplock break from a local file open), and the client closed the file and then re-opened another file which happened to use the same file descriptor as the file just closed, then theoretically the oplock break requests could be processed on the wrong fd. Here's why this should be very rare.. Processing a pending signal always take precedence over an incoming network request, so as long as the client close request is non-chained then the break signal should always be harmlessly processed *before* the open can be called. If the open is chained onto the close, and the fd on the new open is the same as the old closed fd, then it's possible this race will occur. However, all that will happen is that we'll lose the oplock on this file. A shame, but not a fatal event. Jeremy.
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/oplock_linux.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/source3/smbd/oplock_linux.c b/source3/smbd/oplock_linux.c
index 535e809616..c60c745177 100644
--- a/source3/smbd/oplock_linux.c
+++ b/source3/smbd/oplock_linux.c
@@ -99,8 +99,8 @@ static void linux_oplock_signal_handler(struct tevent_context *ev_ctx,
fsp = file_find_fd(fd);
if (fsp == NULL) {
- DEBUG(0,("linux_oplock_signal_handler: failed to find fsp for file fd=%d\n", fd ));
- smb_panic("linux_oplock_signal_handler\n");
+ DEBUG(0,("linux_oplock_signal_handler: failed to find fsp for file fd=%d (file was closed ?)\n", fd ));
+ return;
}
break_kernel_oplock(smbd_messaging_context(), fsp);
}