summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-10-20 17:52:34 -0700
committerJeremy Allison <jra@samba.org>2009-10-20 17:52:34 -0700
commitbb7cf9ad23b05416aa6a50de8b2b3b6aad674809 (patch)
tree19734d609f7a99e22de1e40ad7e822c98406ec10 /source3/smbd
parent49b23fe248ae6582ad1c12c52c2cd7a658964c0c (diff)
downloadsamba-bb7cf9ad23b05416aa6a50de8b2b3b6aad674809.tar.gz
samba-bb7cf9ad23b05416aa6a50de8b2b3b6aad674809.tar.bz2
samba-bb7cf9ad23b05416aa6a50de8b2b3b6aad674809.zip
Fix bug 6828 - infinite timeout occurs when byte lock held outside of samba
Jeremy.
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/blocking.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index e752194ca5..01d9ca8105 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -48,6 +48,22 @@ static void brl_timeout_fn(struct event_context *event_ctx,
}
/****************************************************************************
+ We need a version of timeval_min that treats zero timval as infinite.
+****************************************************************************/
+
+static struct timeval timeval_brl_min(const struct timeval *tv1,
+ const struct timeval *tv2)
+{
+ if (timeval_is_zero(tv1)) {
+ return *tv2;
+ }
+ if (timeval_is_zero(tv2)) {
+ return *tv1;
+ }
+ return timeval_min(tv1, tv2);
+}
+
+/****************************************************************************
After a change to blocking_lock_queue, recalculate the timed_event for the
next processing.
****************************************************************************/
@@ -70,19 +86,13 @@ static bool recalc_brl_timeout(void)
*/
if (blr->blocking_pid == 0xFFFFFFFF) {
struct timeval psx_to = timeval_current_ofs(10, 0);
- next_timeout = timeval_min(&next_timeout, &psx_to);
+ next_timeout = timeval_brl_min(&next_timeout, &psx_to);
}
continue;
}
- if (timeval_is_zero(&next_timeout)) {
- next_timeout = blr->expire_time;
- }
- else {
- next_timeout = timeval_min(&next_timeout,
- &blr->expire_time);
- }
+ next_timeout = timeval_brl_min(&next_timeout, &blr->expire_time);
}
if (timeval_is_zero(&next_timeout)) {