From: Ralph Boehme Date: Sat, 6 Dec 2025 16:37:35 +0000 (+0100) Subject: scavenger: prepare cleaning up stale delete-on-close tokens in the scavenger X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dc3f781d0b15e9614ed9008d14607b5aff6acf82;p=thirdparty%2Fsamba.git scavenger: prepare cleaning up stale delete-on-close tokens in the scavenger Pass the fsp->name_hash to the scavenger and down to share_mode_cleanup_disconnected(). Not yet used. Signed-off-by: Ralph Boehme Reviewed-by: Anoop C S --- diff --git a/source3/smbd/scavenger.c b/source3/smbd/scavenger.c index 194ff2bdaaf..cc887214858 100644 --- a/source3/smbd/scavenger.c +++ b/source3/smbd/scavenger.c @@ -49,6 +49,7 @@ static struct smbd_scavenger_state *smbd_scavenger_state = NULL; struct scavenger_message { struct file_id file_id; uint64_t open_persistent_id; + uint32_t name_hash; NTTIME until; }; @@ -433,6 +434,7 @@ void scavenger_schedule_disconnected(struct files_struct *fsp) ZERO_STRUCT(msg); msg.file_id = fsp->file_id; msg.open_persistent_id = fsp->op->global->open_persistent_id; + msg.name_hash = fsp->name_hash; msg.until = timeval_to_nttime(&until); DEBUG(10, ("smbd: %s mark file %s as disconnected at %s with timeout " @@ -472,6 +474,7 @@ struct scavenger_timer_context { struct cleanup_disconnected_state { struct file_id fid; + uint32_t name_hash; struct share_mode_lock *lck; uint64_t open_persistent_id; struct share_mode_entry e; @@ -515,11 +518,12 @@ static bool cleanup_disconnected_share_mode_entry_fn( } static bool share_mode_cleanup_disconnected( - struct file_id fid, uint64_t open_persistent_id) + struct file_id fid, uint64_t open_persistent_id, uint32_t name_hash) { struct cleanup_disconnected_state state = { .fid = fid, - .open_persistent_id = open_persistent_id + .open_persistent_id = open_persistent_id, + .name_hash = name_hash, }; bool ret = false; TALLOC_CTX *frame = talloc_stackframe(); @@ -626,7 +630,8 @@ static void scavenger_timer(struct tevent_context *ev, } ok = share_mode_cleanup_disconnected(ctx->msg.file_id, - ctx->msg.open_persistent_id); + ctx->msg.open_persistent_id, + ctx->msg.name_hash); if (!ok) { DBG_WARNING("Failed to cleanup share modes and byte range " "locks for file %s open %"PRIu64"\n",