]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: support breaking leases on an object where we don't have an own internal open
authorRalph Boehme <slow@samba.org>
Thu, 22 May 2025 14:57:49 +0000 (16:57 +0200)
committerRalph Boehme <slow@samba.org>
Wed, 28 May 2025 15:06:29 +0000 (15:06 +0000)
So far, when dealing with the rename destination, we had an internal open on
that which ensured get_existing_share_mode_lock() would always return a
lock.

Subsequently I'll want delay_for_handle_lease_break_send() to be callable on an
object that doesn't have a full internal open including locking.tdb entry, but
merely an open handle from filename_convert_dirfsp().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15861

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Bjoern Jacke <bjacke@samba.org>
source3/smbd/smb2_oplock.c

index d1f3e85d3ed34fbe6052b58ae140e70df74c8d37..4e877c147caf16110ff07057c7b2b6d026fae1f4 100644 (file)
@@ -1639,6 +1639,12 @@ static void delay_for_handle_lease_break_fsp_check(struct tevent_req *req)
 
        DBG_DEBUG("fsp [%s]\n", fsp_str_dbg(state->fsp));
 
+       if (state->lck == NULL) {
+               DBG_DEBUG("fsp [%s] all opens are gone\n",
+                         fsp_str_dbg(state->fsp));
+               return;
+       }
+
        ok = share_mode_forall_leases(state->lck,
                                      delay_for_handle_lease_break_fn,
                                      state);
@@ -1696,11 +1702,6 @@ static void delay_for_handle_lease_break_fsp_done(struct tevent_req *subreq)
        }
 
        state->lck = get_existing_share_mode_lock(state, state->fsp->file_id);
-       if (state->lck == NULL) {
-               tevent_req_nterror(req, NT_STATUS_UNSUCCESSFUL);
-               return;
-       }
-
        /*
         * This could potentially end up looping for some if a client
         * aggressively reaquires H-leases on the file, but we have a
@@ -1964,11 +1965,6 @@ static void delay_for_handle_lease_break_below_done(struct tevent_req *subreq)
        state->recursive_h_leases_break = false;
 
        state->lck = get_existing_share_mode_lock(state, state->fsp->file_id);
-       if (state->lck == NULL) {
-               tevent_req_nterror(req, NT_STATUS_UNSUCCESSFUL);
-               return;
-       }
-
        delay_for_handle_lease_break_check(req);
 }