diff mbox series

ksmbd: only v2 leases handle the directory

Message ID CAKYAXd_BwOLLKmV6BSwPoCF=TXn7cKBMQVGsx+4o0gyKBj-hzg@mail.gmail.com
State New
Headers show
Series ksmbd: only v2 leases handle the directory | expand

Commit Message

Namjae Jeon Jan. 15, 2024, 1:34 a.m. UTC
From: Namjae Jeon <linkinjeon@kernel.org>

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.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
 fs/smb/server/oplock.c | 6 ++++++
 1 file changed, 6 insertions(+)

 		return -ENOMEM;
diff mbox series

Patch

diff --git a/fs/smb/server/oplock.c b/fs/smb/server/oplock.c
index 001926d3b348..53dfaac425c6 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)