]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/locking: deal with Persistent Handles in share_mode_forall_entries()
authorRalph Boehme <slow@samba.org>
Sun, 3 Aug 2025 10:54:59 +0000 (12:54 +0200)
committerRalph Boehme <slow@samba.org>
Fri, 17 Jul 2026 10:18:36 +0000 (10:18 +0000)
Handle deleting a Persistent Handle.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/locking/share_mode_lock.c

index 9d8fee81ef1b0ce6b6013596935f73227d9ca735..90fc4baaa7cb247e9bf56b63c2556d29947c3018 100644 (file)
@@ -2221,6 +2221,7 @@ done:
 }
 
 static bool share_mode_for_one_entry(
+       struct share_mode_data *d,
        bool (*fn)(struct share_mode_entry *e,
                   bool *modified,
                   void *private_data),
@@ -2278,6 +2279,10 @@ static bool share_mode_for_one_entry(
                                SHARE_MODE_ENTRY_SIZE);
                }
                *num_share_modes -= 1;
+               if (e.flags & SHARE_ENTRY_FLAG_PERSISTENT_OPEN) {
+                       SMB_ASSERT(d->num_persistent > 0);
+                       d->num_persistent--;
+               }
                *writeback = true;
                return stop;
        }
@@ -2363,6 +2368,7 @@ bool share_mode_forall_entries(
        i = 0;
        while (i<num_share_entries) {
                stop = share_mode_for_one_entry(
+                       d,
                        fn,
                        private_data,
                        &i,