]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tdb: Purge dead records whenever we block the freelist
authorVolker Lendecke <vl@samba.org>
Thu, 25 Oct 2018 13:55:29 +0000 (15:55 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 29 Oct 2018 22:36:25 +0000 (23:36 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/tdb/common/freelist.c

index 5afd89bc55486ea6c5205a4928a6911150fd7f52..5221bf3679e6acf5fb02b25eabbeb9d79bd80529 100644 (file)
@@ -619,6 +619,12 @@ blocking_freelist_allocate:
        if (tdb_lock(tdb, -1, F_WRLCK) == -1) {
                return 0;
        }
+       /*
+        * Dead records can happen even if max_dead_records==0, they
+        * are older than the max_dead_records concept: They happen if
+        * tdb_delete happens concurrently with a traverse.
+        */
+       tdb_purge_dead(tdb, hash);
        ret = tdb_allocate_from_freelist(tdb, length, rec);
        tdb_unlock(tdb, -1, F_WRLCK);
        return ret;