s3:lib/server_mutex: open mutex.tdb with CLEAR_IF_FIRST
authorStefan Metzmacher <metze@samba.org>
Thu, 28 Mar 2013 10:04:31 +0000 (11:04 +0100)
committerKarolin Seeger <kseeger@samba.org>
Mon, 27 May 2013 11:51:22 +0000 (13:51 +0200)
/var/lock/samba is typically on tpmfs.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 821171e422133d64e7c07b4d610984c33cd23244)

Fix bug #9805 - s3:lib/server_mutex: open mutex.tdb with CLEAR_IF_FIRST.

source3/lib/server_mutex.c

index 619fbd077f8fd9308f01b38d56522a916cc8915b..38bf2ca393d788b4cf835266c05060b8b5c50975 100644 (file)
@@ -69,7 +69,10 @@ struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,
        }
 
        result->tdb = tdb_wrap_open(result, lock_path("mutex.tdb"), 0,
-                                   TDB_DEFAULT, O_RDWR|O_CREAT, 0600, lp_ctx);
+                                   TDB_DEFAULT |
+                                   TDB_CLEAR_IF_FIRST |
+                                   TDB_INCOMPATIBLE_HASH,
+                                   O_RDWR|O_CREAT, 0600, lp_ctx);
        talloc_unlink(result, lp_ctx);
        if (result->tdb == NULL) {
                DEBUG(1, ("Could not open mutex.tdb: %s\n",