From: Volker Lendecke Date: Wed, 4 Nov 2020 14:51:51 +0000 (+0100) Subject: smbd: Don't set share_mode_lock modified in grant_new_fsp_lease() X-Git-Tag: samba-4.14.0rc1~652 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=271a369fb94fb4affdd8725c9cce829bb5d85c93;p=thirdparty%2Fsamba.git smbd: Don't set share_mode_lock modified in grant_new_fsp_lease() A new lease never triggers a retry. Setting d->modified to true just triggered the watchers needlessly. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 1419fb5128d..b578c4dae75 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2278,7 +2278,6 @@ static NTSTATUS grant_new_fsp_lease(struct files_struct *fsp, const struct smb2_lease *lease, uint32_t granted) { - struct share_mode_data *d = lck->data; NTSTATUS status; fsp->lease = talloc_zero(fsp->conn->sconn, struct fsp_lease); @@ -2308,7 +2307,21 @@ static NTSTATUS grant_new_fsp_lease(struct files_struct *fsp, return NT_STATUS_INSUFFICIENT_RESOURCES; } - d->modified = true; + /* + * We used to set lck->data->modified=true here without + * actually modifying lck->data, triggering a needless + * writeback of lck->data. + * + * Apart from that writeback, setting modified=true has the + * effect of triggering all waiters for this file to + * retry. This only makes sense if any blocking condition + * (i.e. waiting for a lease to be downgraded or removed) is + * gone. This routine here only adds a lease, so it will never + * free up resources that blocked waiters can now claim. So + * that second effect also does not matter in this + * routine. Thus setting lck->data->modified=true does not + * need to be done here. + */ return NT_STATUS_OK; }