[SCM] Samba Shared Repository - branch master updated - c07ea13d3077f73ad6cb28e9689b120bca6eac74

Jeremy Allison jra at samba.org
Thu Jan 8 18:37:23 GMT 2009


The branch, master has been updated
       via  c07ea13d3077f73ad6cb28e9689b120bca6eac74 (commit)
      from  154e08f275f1d20f0c8bdf1c876dc1ec780b1db2 (commit)

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


- Log -----------------------------------------------------------------
commit c07ea13d3077f73ad6cb28e9689b120bca6eac74
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Jan 8 10:36:10 2009 -0800

    Fix race condition in alarm lock processing noticed by Richard Sharpe <realrichardsharpe at gmail.com>.
    "It seems to me that if the lock is already held by another process when we
    enter this code, there is a race between the timeout and the granting. If
    the lock is subsequently granted, the process releasing the lock will signal
    the wait variable (or whatever) and our process will be scheduled. However,
    if the timeout occurs before we are scheduled, the timeout will be delivered
    first.
    
    We will have the lock but will forget we have the lock, and never release
    it."
    Jeremy.

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

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


Changeset truncated at 500 lines:

diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c
index bb568bc..8ceaa46 100644
--- a/source3/lib/util_tdb.c
+++ b/source3/lib/util_tdb.c
@@ -64,7 +64,7 @@ static int tdb_chainlock_with_timeout_internal( TDB_CONTEXT *tdb, TDB_DATA key,
 		alarm(0);
 		tdb_setalarm_sigptr(tdb, NULL);
 		CatchSignal(SIGALRM, SIGNAL_CAST SIG_IGN);
-		if (gotalarm) {
+		if (gotalarm && (ret == -1)) {
 			DEBUG(0,("tdb_chainlock_with_timeout_internal: alarm (%u) timed out for key %s in tdb %s\n",
 				timeout, key.dptr, tdb_name(tdb)));
 			/* TODO: If we time out waiting for a lock, it might


-- 
Samba Shared Repository


More information about the samba-cvs mailing list