]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: let delay_for_oplock_fn() only call leases_db_get() once
authorStefan Metzmacher <metze@samba.org>
Mon, 15 Aug 2022 07:56:15 +0000 (09:56 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 19 Aug 2022 19:39:18 +0000 (19:39 +0000)
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 <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Aug 19 19:39:18 UTC 2022 on sn-devel-184

source3/smbd/open.c

index 0cb56c7830b3d992d2342488b9757444ff85c1a5..d5c2f4c830f1459a7a327162bb729eaae458d4dd 100644 (file)
@@ -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 &&