From: Ralph Boehme Date: Thu, 22 May 2025 14:57:49 +0000 (+0200) Subject: smbd: support breaking leases on an object where we don't have an own internal open X-Git-Tag: tevent-0.17.0~95 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=03c46342e2a65e6d81bd581471310c0ec2cbbdfb;p=thirdparty%2Fsamba.git smbd: support breaking leases on an object where we don't have an own internal open 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 Reviewed-by: Bjoern Jacke --- diff --git a/source3/smbd/smb2_oplock.c b/source3/smbd/smb2_oplock.c index d1f3e85d3ed..4e877c147ca 100644 --- a/source3/smbd/smb2_oplock.c +++ b/source3/smbd/smb2_oplock.c @@ -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); }