s3: Slightly increase parallelism in g_lock
authorVolker Lendecke <vl@samba.org>
Tue, 16 Feb 2010 11:31:58 +0000 (12:31 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 16 Feb 2010 15:39:50 +0000 (16:39 +0100)
There's no need to still hold the g_lock tdb-level lock while telling the
waiters to retry

source3/lib/g_lock.c

index 54441643278e2e6b5bd4d69ec09b5c6ce31282b3..fc21a304be768109b05c96308494d55669a13f1a 100644 (file)
@@ -537,6 +537,8 @@ static NTSTATUS g_lock_force_unlock(struct g_lock_ctx *ctx, const char *name,
                goto done;
        }
 
+       TALLOC_FREE(rec);
+
        if ((lock_type & G_LOCK_PENDING) == 0) {
                int num_wakeups = 0;
 
@@ -576,9 +578,13 @@ static NTSTATUS g_lock_force_unlock(struct g_lock_ctx *ctx, const char *name,
                }
        }
 done:
+       /*
+        * For the error path, TALLOC_FREE(rec) as well. In the good
+        * path we have already freed it.
+        */
+       TALLOC_FREE(rec);
 
        TALLOC_FREE(locks);
-       TALLOC_FREE(rec);
        return status;
 }