aboutsummaryrefslogtreecommitdiffstats
path: root/fs/smb
diff options
context:
space:
mode:
authorNamjae Jeon <linkinjeon@kernel.org>2024-01-15 10:24:54 +0900
committerSteve French <stfrench@microsoft.com>2024-01-14 22:14:56 -0600
commit77bebd186442a7d703b796784db7495129cc3e70 (patch)
treec2c0e0ef6d40f4fe0be2fcbc6f3e64b2d939e19c /fs/smb
parent38d20c62903d669693a1869aa68c4dd5674e2544 (diff)
downloadlinux-77bebd186442a7d703b796784db7495129cc3e70.tar.gz
ksmbd: only v2 leases handle the directory
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>
Diffstat (limited to 'fs/smb')
-rw-r--r--fs/smb/server/oplock.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/smb/server/oplock.c b/fs/smb/server/oplock.c
index 001926d3b348c..53dfaac425c68 100644
--- a/fs/smb/server/oplock.c
+++ b/fs/smb/server/oplock.c
@@ -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;