From d4f18f99d3a40a8df00beb006e2731959aa6fad9 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 15 Aug 2022 09:56:15 +0200 Subject: [PATCH] s3:smbd: let delay_for_oplock_fn() only call leases_db_get() once get_lease_type() will just call leases_db_get() again for leases, so only call it for oplocks. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15125 Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Fri Aug 19 19:39:18 UTC 2022 on sn-devel-184 --- source3/smbd/open.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 0cb56c7830b..d5c2f4c830f 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2536,7 +2536,7 @@ static bool delay_for_oplock_fn( struct files_struct *fsp = state->fsp; const struct smb2_lease *lease = state->lease; bool e_is_lease = (e->op_type == LEASE_OPLOCK); - uint32_t e_lease_type = get_lease_type(e, fsp->file_id); + uint32_t e_lease_type = SMB2_LEASE_NONE; uint32_t break_to; bool lease_is_breaking = false; @@ -2555,7 +2555,7 @@ static bool delay_for_oplock_fn( &e->client_guid, &e->lease_key, &fsp->file_id, - NULL, /* current_state */ + &e_lease_type, /* current_state */ &lease_is_breaking, NULL, /* breaking_to_requested */ NULL, /* breaking_to_required */ @@ -2597,6 +2597,8 @@ static bool delay_for_oplock_fn( nt_errstr(status)); smb_panic("leases_db_get() failed"); } + } else { + e_lease_type = get_lease_type(e, fsp->file_id); } if (!state->got_handle_lease && -- 2.47.3