diff options
-rw-r--r-- | source/include/proto.h | 1 | ||||
-rw-r--r-- | source/smbd/oplock.c | 14 | ||||
-rw-r--r-- | source/smbd/process.c | 8 |
3 files changed, 22 insertions, 1 deletions
diff --git a/source/include/proto.h b/source/include/proto.h index 9eeea171cd3..e05b196e93c 100644 --- a/source/include/proto.h +++ b/source/include/proto.h @@ -4166,6 +4166,7 @@ BOOL check_file_sharing(connection_struct *conn,char *fname, BOOL rename_op); /*The following definitions come from smbd/oplock.c */ int32 get_number_of_exclusive_open_oplocks(void); +BOOL oplock_message_waiting(fd_set *fds); BOOL receive_local_message(fd_set *fds, char *buffer, int buffer_len, int timeout); BOOL set_file_oplock(files_struct *fsp, int oplock_type); void release_file_oplock(files_struct *fsp); diff --git a/source/smbd/oplock.c b/source/smbd/oplock.c index 26d193e2c2a..7033eddc163 100644 --- a/source/smbd/oplock.c +++ b/source/smbd/oplock.c @@ -48,6 +48,20 @@ int32 get_number_of_exclusive_open_oplocks(void) return exclusive_oplocks_open; } +/**************************************************************************** + Return True if an oplock message is pending. +****************************************************************************/ + +BOOL oplock_message_waiting(fd_set *fds) +{ + if (koplocks && koplocks->msg_waiting(fds)) + return True; + + if (FD_ISSET(oplock_sock, fds)) + return True; + + return False; +} /**************************************************************************** Read an oplock break message from either the oplock UDP fd or the diff --git a/source/smbd/process.c b/source/smbd/process.c index a304b1e4a25..e67d8728b1a 100644 --- a/source/smbd/process.c +++ b/source/smbd/process.c @@ -223,7 +223,13 @@ static BOOL receive_message_or_smb(char *buffer, int buffer_len, int timeout) return False; } - if (!FD_ISSET(smbd_server_fd(),&fds) || selrtn > 1) { + /* + * Ensure we process oplock break messages by preference. + * This is IMPORTANT ! Otherwise we can starve other processes + * sending us an oplock break message. JRA. + */ + + if (oplock_message_waiting(&fds)) { async_processing(&fds, buffer, buffer_len); if (!FD_ISSET(smbd_server_fd(),&fds)) goto again; } |