]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Don't set share_mode_lock modified in grant_new_fsp_lease()
authorVolker Lendecke <vl@samba.org>
Wed, 4 Nov 2020 14:51:51 +0000 (15:51 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 10 Nov 2020 19:49:35 +0000 (19:49 +0000)
A new lease never triggers a retry. Setting d->modified to true just
triggered the watchers needlessly.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/open.c

index 1419fb5128d46fad84ff9626439c51ba62c513d1..b578c4dae757188e133ecfa2dab9854df9920dd9 100644 (file)
@@ -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;
 }