]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
scavenger: clean up stale delete-on-close tokens in the scavenger
authorRalph Boehme <slow@samba.org>
Mon, 1 Dec 2025 16:48:24 +0000 (17:48 +0100)
committerRalph Boehme <slow@samba.org>
Fri, 17 Jul 2026 10:18:37 +0000 (10:18 +0000)
Currently we discard Durable Handles when processing a client disconnect that
have delete-on-close set, which will then also clean up the delete-on-close
token.

This is going to change for Persistent Handles, so we have to prepare for
cleaning up delete-on-close tokens in the scavenger.

Windows takes it one step further and the file gets actually deleted: on Windows
delete-on-close in set at the FSA layer so when the scavenger closes the handle,
the filesystem will just follow standard delete-on-close processing and delete
the file.

For Samba this is hard to implement in the scavenger, as it would need to be
extended to be able talk to the Samba VFS to delete the file, so we merely
remove the stale delete-token and without deleting the file.

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

index 8c5835bdf307149e451970c0e7fd7512b90a94b0..49698f35e8ffd0f4b7748b7ccf127739afdb6087 100644 (file)
@@ -496,6 +496,10 @@ static bool cleanup_disconnected_share_mode_entry_fn(
                return false;
        }
 
+       reset_delete_on_close_lck_open_id(state->lck,
+                                         state->name_hash,
+                                         state->open_persistent_id);
+
        /*
         * Setting e->stale = true is
         * the indication to delete the entry.