tdb: Don't purge records to a blocked freelist
authorVolker Lendecke <vl@samba.org>
Mon, 17 Mar 2014 05:47:11 +0000 (06:47 +0100)
committerMichael Adam <obnox@samba.org>
Tue, 18 Mar 2014 12:42:10 +0000 (13:42 +0100)
If the freelist is heavily contended, we should avoid accessing it

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/tdb/common/tdb.c

index 3aabcfa9e606671efc19114ee954150133d28ccd..634a5526d71893ecfd8b4f99ab540c0279bb3707 100644 (file)
@@ -351,7 +351,10 @@ static int tdb_purge_dead(struct tdb_context *tdb, uint32_t hash)
        struct tdb_record rec;
        tdb_off_t rec_ptr;
 
-       if (tdb_lock(tdb, -1, F_WRLCK) == -1) {
+       if (tdb_lock_nonblock(tdb, -1, F_WRLCK) == -1) {
+               /*
+                * Don't block the freelist if not strictly necessary
+                */
                return -1;
        }