]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/brlock: add support for opening brlock.tdb with DBWRAP_FLAG_PER_REC_PERSISTENT
authorRalph Boehme <slow@samba.org>
Fri, 19 Jun 2026 13:15:14 +0000 (15:15 +0200)
committerRalph Boehme <slow@samba.org>
Fri, 17 Jul 2026 10:18:37 +0000 (10:18 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/locking/brlock.c

index 62d23e497e6c26c8663e7c761ea6086c58bb017c..3d99941d4f36dccba7c3be4a6b1a06fd5572a3e2 100644 (file)
@@ -345,6 +345,7 @@ void brl_init(bool read_only)
 {
        int tdb_flags;
        char *db_path;
+       uint64_t dbwrap_flags = DBWRAP_FLAG_NONE;
 
        if (brlock_db) {
                return;
@@ -358,10 +359,14 @@ void brl_init(bool read_only)
                return;
        }
 
+       if (lp_persistent_handles()) {
+               dbwrap_flags |= DBWRAP_FLAG_PER_REC_PERSISTENT;
+       }
+
        brlock_db = db_open(NULL, db_path,
                            SMBD_VOLATILE_TDB_HASH_SIZE, tdb_flags,
                            read_only?O_RDONLY:(O_RDWR|O_CREAT), 0640,
-                           DBWRAP_LOCK_ORDER_2, DBWRAP_FLAG_NONE);
+                           DBWRAP_LOCK_ORDER_2, dbwrap_flags);
        if (!brlock_db) {
                DEBUG(0,("Failed to open byte range locking database %s\n",
                         db_path));