Closed sppmasterspp closed 10 months ago
Please use the higher version ksmbd-tools than 3.4.8.
@neheb openWRT should upgrade ksmbd-tools in openWRT with the latest version. Can you request it ?
@sppmasterspp ksmbd-tools-3.5.1 seems to be merged into openWRT. Can you check if your problem is fixed ?
@sppmasterspp ksmbd-tools-3.5.1 seems to be merged into openWRT. Can you check if your problem is fixed ?
Yes, recompiled this morning with latest changes and all is OK. The issue is fixed. Thanks a lot guys.
@neheb Thanks for your help!
@ptpt52 I can not attach the patch in github. Can you temporarily apply the following patch to openWRT's 5.15 and 6.1 kernel ? I need the time to apply this patch to mainline and stable kernels.(may take about 2 weeks)
From a65ef261519e1dc3ff7f1ae3c740487ab2e961e8 Mon Sep 17 00:00:00 2001
From: Namjae Jeon <linkinjeon@kernel.org>
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: 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 | 6 ++++++
1 file changed, 6 insertions(+)
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)
return -ENOMEM;
--
2.34.1
looks into the code in kernel 5.15 It looks like that it is now not support directory lease? @namjaejeon
int smb_grant_oplock(struct ksmbd_work *work, int req_op_level, u64 pid,
struct ksmbd_file *fp, __u16 tid,
struct lease_ctx_info *lctx, int share_ret)
{
struct ksmbd_session *sess = work->sess;
int err = 0;
struct oplock_info *opinfo = NULL, *prev_opinfo = NULL;
struct ksmbd_inode *ci = fp->f_ci;
bool prev_op_has_lease;
__le32 prev_op_state = 0;
/* not support directory lease */
if (S_ISDIR(file_inode(fp->filp)->i_mode))
return 0;
opinfo = alloc_opinfo(work, pid, tid);
if (!opinfo)
return -ENOMEM;
if (lctx) {
err = alloc_lease(opinfo, lctx);
if (err)
goto err_out;
opinfo->is_lease = 1;
}
/* ci does not have any oplock */
if (!opinfo_count(fp))
goto set_lev;
/* grant none-oplock if second open is trunc */
if (fp->attrib_only && fp->cdoption != FILE_OVERWRITE_IF_LE &&
fp->cdoption != FILE_OVERWRITE_LE &&
fp->cdoption != FILE_SUPERSEDE_LE) {
req_op_level = SMB2_OPLOCK_LEVEL_NONE;
goto set_lev;
}
...
@ptpt52 Oh, Thanks for your work!
@sppmasterspp If your issues are fixed, Please close this.
I closed this. Everithing is OK - compiled with above @ptpt52 PR. Thank You!
Ksmbd-server Version 3.4.8-1
Description: I saw there were a lot of ksmbd changes (commits) in kernel 6.1.71. Having compiled a new build with 6.1.71 I cannot access the root directory of shared disk. Actually it opens but is shown as empty on all devices.
The files are still there
but not visible in file explorers on different devices. Writing to the root shared folder is not possible either. I can write to the down directories if I access them directly via address bar. It worked normally with kernel 6.1.69. I can view and access the mounted device directories with
cd
andls
commands via router SSH console and I can open some shared directories down the root directory from Windows File Explorer typing the address in the address bar.The discussion on OpenWrt forum.