]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: get rid of fsp arg to reset_delete_on_close_lck()
authorRalph Boehme <slow@samba.org>
Mon, 1 Dec 2025 16:41:16 +0000 (17:41 +0100)
committerRalph Boehme <slow@samba.org>
Fri, 17 Jul 2026 10:18:36 +0000 (10:18 +0000)
We need reset_delete_on_close_lck() to be callable from the scavenger who
doesn't have any fsp's.

No change in behaviour.

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

index dbefbd16f9f0fa5bb6d383f722dc9bfa4022995d..f3f51682e680d84e0e1cecdfb93035f7f7cb17ec 100644 (file)
@@ -799,8 +799,8 @@ static bool add_delete_on_close_token(struct share_mode_data *d,
        return true;
 }
 
-void reset_delete_on_close_lck(files_struct *fsp,
-                              struct share_mode_lock *lck)
+void reset_delete_on_close_lck(struct share_mode_lock *lck,
+                              uint32_t name_hash)
 {
        struct share_mode_data *d = NULL;
        NTSTATUS status;
@@ -809,8 +809,8 @@ void reset_delete_on_close_lck(files_struct *fsp,
        status = share_mode_lock_access_private_data(lck, &d);
        if (!NT_STATUS_IS_OK(status)) {
                /* Any error recovery possible here ? */
-               DBG_ERR("share_mode_lock_access_private_data() failed for "
-                       "%s - %s\n", fsp_str_dbg(fsp), nt_errstr(status));
+               DBG_ERR("share_mode_lock_access_private_data() failed: %s\n",
+                       nt_errstr(status));
                smb_panic(__location__);
                return;
        }
@@ -818,7 +818,7 @@ void reset_delete_on_close_lck(files_struct *fsp,
        for (i=0; i<d->num_delete_tokens; i++) {
                struct delete_token *dt = &d->delete_tokens[i];
 
-               if (dt->name_hash == fsp->name_hash) {
+               if (dt->name_hash == name_hash) {
                        d->modified = true;
 
                        /* Delete this entry. */
@@ -969,7 +969,7 @@ static void set_delete_on_close_locked(struct share_mode_lock *lck,
                                        state->nt_tok,
                                        state->tok);
        } else {
-               reset_delete_on_close_lck(state->fsp, lck);
+               reset_delete_on_close_lck(lck, state->fsp->name_hash);
        }
 
        state->fsp->fsp_flags.delete_on_close = state->delete_on_close;
index ab19632abb7512cc801d1172a2c1ac151ddfa5fa..e12c34712a4c5d82066cf9a206ee53cb87df428c 100644 (file)
@@ -166,8 +166,8 @@ bool get_delete_on_close_token(struct share_mode_lock *lck,
                                const struct security_token **pp_nt_tok,
                                const struct security_unix_token **pp_tok,
                                struct smb2_lease_key *parent_lease_key);
-void reset_delete_on_close_lck(files_struct *fsp,
-                              struct share_mode_lock *lck);
+void reset_delete_on_close_lck(struct share_mode_lock *lck,
+                              uint32_t name_hash);
 void set_delete_on_close_lck(files_struct *fsp,
                        struct share_mode_lock *lck,
                        const struct security_token *nt_tok,
index 8eb3bd47aebf5fc4a46ae2c0e164ef7535082a69..9ccbf1aa40987528cb3f2bbec134d676a073d717 100644 (file)
@@ -449,7 +449,7 @@ static void close_share_mode_lock_cleanup(struct share_mode_lock *lck,
        bool ok;
 
        if (state->reset_delete_on_close) {
-               reset_delete_on_close_lck(fsp, lck);
+               reset_delete_on_close_lck(lck, fsp->name_hash);
        }
 
        ok = del_share_mode(lck, fsp);