-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kernel: ksmbd: only v2 leases handle the directory
This backport a fix for ksmbd. Refer: namjaejeon/ksmbd#469 Signed-off-by: Chen Minqiang <[email protected]>
- Loading branch information
Showing
2 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
target/linux/generic/pending-5.15/540-ksmbd-only-v2-leases-handle-the-directory.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
From cb1d41b99e4afa062f904339666fae2578559718 Mon Sep 17 00:00:00 2001 | ||
From: Namjae Jeon <[email protected]> | ||
Date: Mon, 15 Jan 2024 10:24:54 +0900 | ||
Subject: [PATCH] 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: [email protected] | ||
Signed-off-by: Namjae Jeon <[email protected]> | ||
Signed-off-by: Steve French <[email protected]> | ||
--- | ||
fs/ksmbd/oplock.c | 6 ++++++ | ||
1 file changed, 6 insertions(+) | ||
|
||
--- a/fs/ksmbd/oplock.c | ||
+++ b/fs/ksmbd/oplock.c | ||
@@ -1191,6 +1191,12 @@ int smb_grant_oplock(struct ksmbd_work * | ||
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; |
32 changes: 32 additions & 0 deletions
32
target/linux/generic/pending-6.1/540-ksmbd-only-v2-leases-handle-the-directory.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
From 86b7307af26834415e1ba8597319a8b64846346f Mon Sep 17 00:00:00 2001 | ||
From: Namjae Jeon <[email protected]> | ||
Date: Mon, 15 Jan 2024 10:24:54 +0900 | ||
Subject: [PATCH] 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: [email protected] | ||
Signed-off-by: Namjae Jeon <[email protected]> | ||
Signed-off-by: Steve French <[email protected]> | ||
--- | ||
fs/smb/server/oplock.c | 6 ++++++ | ||
1 file changed, 6 insertions(+) | ||
|
||
--- a/fs/smb/server/oplock.c | ||
+++ b/fs/smb/server/oplock.c | ||
@@ -1191,6 +1191,12 @@ int smb_grant_oplock(struct ksmbd_work * | ||
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; |