diff options
author | Jeremy Allison <jra@samba.org> | 2002-05-21 20:52:30 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2002-05-21 20:52:30 +0000 |
commit | e486d0fa03113bdabb0d97f0d91eb7fc488fa361 (patch) | |
tree | e045fac14fc91745a537e130b9b9e931a92e21dd /source3/smbd/oplock.c | |
parent | 195d578c8de4dfa8045f8f1495e7cd3df985d3f6 (diff) | |
download | samba-e486d0fa03113bdabb0d97f0d91eb7fc488fa361.tar.gz samba-e486d0fa03113bdabb0d97f0d91eb7fc488fa361.tar.bz2 samba-e486d0fa03113bdabb0d97f0d91eb7fc488fa361.zip |
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)
Diffstat (limited to 'source3/smbd/oplock.c')
-rw-r--r-- | source3/smbd/oplock.c | 11 |
1 files changed, 11 insertions, 0 deletions
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 */ |