From: Volker Lendecke Date: Fri, 17 May 2019 13:29:59 +0000 (+0200) Subject: smbd: Calculate delay_mask only once in delay_for_oplock X-Git-Tag: ldb-2.0.5~666 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=1a59b0fa638ce33f7a7fda07f26509a3370b76b4;p=thirdparty%2Fsamba.git smbd: Calculate delay_mask only once in delay_for_oplock "const" ist just a hint to make sure it's actually not modified inside the loop Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 0a4abe0d820..8e9de5e11b4 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1849,6 +1849,8 @@ static bool delay_for_oplock(files_struct *fsp, uint32_t i; bool delay = false; bool will_overwrite; + const uint32_t delay_mask = have_sharing_violation ? + SMB2_LEASE_HANDLE : SMB2_LEASE_WRITE; if ((oplock_request & INTERNAL_OPEN_ONLY) || is_stat_open(fsp->access_mask)) { @@ -1871,7 +1873,6 @@ static bool delay_for_oplock(files_struct *fsp, bool e_is_lease = (e->op_type == LEASE_OPLOCK); uint32_t e_lease_type = get_lease_type(d, e); uint32_t break_to; - uint32_t delay_mask = 0; bool lease_is_breaking = false; if (e_is_lease) { @@ -1902,12 +1903,6 @@ static bool delay_for_oplock(files_struct *fsp, SMB_ASSERT(NT_STATUS_IS_OK(status)); } - if (have_sharing_violation) { - delay_mask = SMB2_LEASE_HANDLE; - } else { - delay_mask = SMB2_LEASE_WRITE; - } - break_to = e_lease_type & ~delay_mask; if (will_overwrite) {