]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ksmbd: only v2 leases handle the directory
authorNamjae Jeon <linkinjeon@kernel.org>
Mon, 15 Jan 2024 01:24:54 +0000 (10:24 +0900)
committerSteve French <stfrench@microsoft.com>
Mon, 15 Jan 2024 04:14:56 +0000 (22:14 -0600)
When smb2 leases is disable, ksmbd can send oplock break notification
and cause wait oplock break ack timeout. It may appear like hang when
accessing a directory. This patch make only v2 leases handle the
directory.

Cc: stable@vger.kernel.org
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/server/oplock.c

index 001926d3b348c88ff98bc1766a6a8b280415e39e..53dfaac425c68dc5f2192924b546b4f9fb71f6c8 100644 (file)
@@ -1197,6 +1197,12 @@ int smb_grant_oplock(struct ksmbd_work *work, int req_op_level, u64 pid,
        bool prev_op_has_lease;
        __le32 prev_op_state = 0;
 
+       /* Only v2 leases handle the directory */
+       if (S_ISDIR(file_inode(fp->filp)->i_mode)) {
+               if (!lctx || lctx->version != 2)
+                       return 0;
+       }
+
        opinfo = alloc_opinfo(work, pid, tid);
        if (!opinfo)
                return -ENOMEM;