From a3c98a841bcedf72ce513917707b5799c37abb95 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 22 May 2002 23:34:47 +0000 Subject: Merge of bugfixes from 2.2. Jeremy. (This used to be commit 5c8351228c55f2403214351f6fd16fe231aee917) --- source3/lib/select.c | 10 ++++++++-- source3/smbd/oplock.c | 10 +++++----- source3/smbd/process.c | 4 +++- 3 files changed, 16 insertions(+), 8 deletions(-) (limited to 'source3') diff --git a/source3/lib/select.c b/source3/lib/select.c index 550941ba77..efcf63becc 100644 --- a/source3/lib/select.c +++ b/source3/lib/select.c @@ -1,5 +1,6 @@ /* - Unix SMB/CIFS implementation. + Unix SMB/Netbios implementation. + Version 3.0 Samba select/poll implementation Copyright (C) Andrew Tridgell 1992-1998 @@ -133,10 +134,12 @@ int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorf { int ret; fd_set *readfds2, readfds_buf, *writefds2, writefds_buf, *errorfds2, errorfds_buf; + struct timeval tval2, *ptval; readfds2 = (readfds ? &readfds_buf : NULL); writefds2 = (writefds ? &writefds_buf : NULL); errorfds2 = (errorfds ? &errorfds_buf : NULL); + ptval = (tval ? &tval2 : NULL); do { if (readfds) @@ -145,7 +148,10 @@ int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorf writefds_buf = *writefds; if (errorfds) errorfds_buf = *errorfds; - ret = sys_select(maxfd, readfds2, writefds2, errorfds2, tval); + if (tval) + tval2 = *tval; + + ret = sys_select(maxfd, readfds2, writefds2, errorfds2, ptval); } while (ret == -1 && errno == EINTR); if (readfds) diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 6a47791300..9bc7d64381 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -99,6 +99,11 @@ BOOL receive_local_message( char *buffer, int buffer_len, int timeout) if (selrtn == -1 && errno == EINTR) { + /* could be a kernel oplock interrupt */ + if (koplocks && koplocks->msg_waiting(&fds)) { + return koplocks->receive_message(&fds, buffer, buffer_len); + } + /* * Linux 2.0.x seems to have a bug in that * it can return -1, EINTR with a timeout of zero. @@ -111,11 +116,6 @@ BOOL receive_local_message( char *buffer, int buffer_len, int timeout) return False; } - - /* could be a kernel oplock interrupt */ - if (koplocks && koplocks->msg_waiting(&fds)) { - return koplocks->receive_message(&fds, buffer, buffer_len); - } /* Not a kernel interrupt - could be a SIGUSR1 message. We must restart. */ /* We need to decrement the timeout here. */ timeout -= ((time(NULL) - starttime)*1000); diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 53f9ff035f..010b188701 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -111,8 +111,10 @@ BOOL push_oplock_pending_smb_message(char *buf, int msg_len) static void async_processing(char *buffer, int buffer_len) { + DEBUG(10,("async_processing: Doing async processing.\n")); + /* check for oplock messages (both UDP and kernel) */ - if (receive_local_message(buffer, buffer_len, 0)) { + if (receive_local_message(buffer, buffer_len, 1)) { process_local_message(buffer, buffer_len); } -- cgit