s3: Slightly increase parallelism in g_lock
authorVolker Lendecke <vl@samba.org>
Tue, 16 Feb 2010 11:31:58 +0000 (12:31 +0100)
committerKarolin Seeger <kseeger@samba.org>
Thu, 1 Apr 2010 07:39:18 +0000 (09:39 +0200)
There's no need to still hold the g_lock tdb-level lock while telling the
waiters to retry
(cherry picked from commit 83542d973ca771353109c7da4b0391d6ba910f53)
(cherry picked from commit eb15655fe1fb71fb7145ce9f479cc112a459f72e)

source3/lib/g_lock.c

index 33ebe948038353b76116c78ad7ee54de073403d9..add670c154dee1b749c92c14bc258f96fd4cadba 100644 (file)
@@ -527,6 +527,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;
 
@@ -566,9 +568,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;
 }