[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Tue Feb 16 07:29:39 MST 2010


The branch, master has been updated
       via  f8b246e... s3: Fix timeout calculation if g_lock_lock is given a timeout < 60s
      from  83542d9... s3: Slightly increase parallelism in g_lock

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit f8b246e44c819b909b23b4b98ef0999c84d2f4ff
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Feb 16 15:21:25 2010 +0100

    s3: Fix timeout calculation if g_lock_lock is given a timeout < 60s
    
    Detected while showing this code to obnox :-)

-----------------------------------------------------------------------

Summary of changes:
 source3/lib/g_lock.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c
index add670c..e4c6d7c 100644
--- a/source3/lib/g_lock.c
+++ b/source3/lib/g_lock.c
@@ -338,7 +338,7 @@ NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, const char *name,
 		fd_set *r_fds = NULL;
 		int max_fd = 0;
 		int ret;
-		struct timeval select_timeout;
+		struct timeval timeout_remaining, select_timeout;
 
 		status = g_lock_trylock(ctx, name, lock_type);
 		if (NT_STATUS_IS_OK(status)) {
@@ -395,8 +395,13 @@ NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, const char *name,
 		}
 #endif
 
+		time_now = timeval_current();
+		timeout_remaining = timeval_until(&time_now, &timeout_end);
 		select_timeout = timeval_set(60, 0);
 
+		select_timeout = timeval_min(&select_timeout,
+					     &timeout_remaining);
+
 		ret = sys_select(max_fd + 1, r_fds, NULL, NULL,
 				 &select_timeout);
 		if (ret == -1) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list