]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Set SHARE_MODE_HAS_READ_LEASE when granting a read lease
authorVolker Lendecke <vl@samba.org>
Sun, 30 Jun 2019 07:15:48 +0000 (09:15 +0200)
committerRalph Boehme <slow@samba.org>
Thu, 4 Jul 2019 14:03:29 +0000 (14:03 +0000)
Lazy update of the flag: Whenever we add a read lease, we have to set
the flag. Nobody except contend_level2_oplocks_begin will remove that
flag again, as this would mean a full lease traverse when removing
one. And contend_level2_oplocks_begin traverses the leases anyway

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/open.c

index b86559ec4178fe33b78c051302cbcf22ba4d04a2..a46e42482f78e04e39ef9dd8416bccd17be2aab0 100644 (file)
@@ -2355,6 +2355,10 @@ static NTSTATUS grant_fsp_oplock_type(struct smb_request *req,
                return NT_STATUS_NO_MEMORY;
        }
 
+       if (granted & SMB2_LEASE_READ) {
+               lck->data->flags |= SHARE_MODE_HAS_READ_LEASE;
+       }
+
        ok = update_num_read_oplocks(fsp, lck);
        if (!ok) {
                del_share_mode(lck, fsp);