From e486d0fa03113bdabb0d97f0d91eb7fc488fa361 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 21 May 2002 20:52:30 +0000 Subject: Tricky fix. If we were waiting for an oplock break response message from another smbd and an incoming SIGUSR1 message arrived we'd break out of the wait early - as we have to use sys_select() to wait for an oplock response message, not sys_select_intr() (which ignores EINTR errors) because of the real time signal kernel interface. Jeremy. (This used to be commit 3bb26957e3e7fb5059d21115546d189eaca34646) --- source3/smbd/oplock.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source3') diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 7022b76c10..781de075b6 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -84,6 +84,11 @@ BOOL receive_local_message(fd_set *fds, char *buffer, int buffer_len, int timeou struct timeval to; int selrtn; int maxfd = oplock_sock; + time_t starttime; + + again: + + starttime = time(NULL); if (koplocks && koplocks->notification_fd != -1) { FD_SET(koplocks->notification_fd, fds); @@ -100,6 +105,12 @@ BOOL receive_local_message(fd_set *fds, char *buffer, int buffer_len, int timeou 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); + if (timeout < 0) + timeout = 0; + goto again; } /* Check if error */ -- cgit