From: Alva Lan <alvalan9@foxmail.com>
To: gregkh@linuxfoundation.org, sashal@kernel.org, stable@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linkinjeon@kernel.org,
stfrench@microsoft.com, d.ornaghi97@gmail.com,
knavaneeth786@gmail.com, charsyam@gmail.com,
Alva Lan <alvalan9@foxmail.com>
Subject: [PATCH 6.6.y v3 1/4] ksmbd: avoid reclaiming expired durable opens by the client
Date: Tue, 26 May 2026 15:58:39 +0800 [thread overview]
Message-ID: <tencent_BBF2D52C7CD44B325AEFE16CC12C3444D00A@qq.com> (raw)
In-Reply-To: <tencent_03EB621C56988886195ADF9AA78F33494007@qq.com>
From: Namjae Jeon <linkinjeon@kernel.org>
[ Upstream commit 520da3c488c5bb177871634e713eb8a106082e6b ]
The expired durable opens should not be reclaimed by client.
This patch add ->durable_scavenger_timeout to fp and check it in
ksmbd_lookup_durable_fd().
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Alva Lan <alvalan9@foxmail.com>
---
fs/smb/server/vfs_cache.c | 9 ++++++++-
fs/smb/server/vfs_cache.h | 1 +
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/fs/smb/server/vfs_cache.c b/fs/smb/server/vfs_cache.c
index eacc6ef41db0..729758697c12 100644
--- a/fs/smb/server/vfs_cache.c
+++ b/fs/smb/server/vfs_cache.c
@@ -515,7 +515,10 @@ struct ksmbd_file *ksmbd_lookup_durable_fd(unsigned long long id)
struct ksmbd_file *fp;
fp = __ksmbd_lookup_fd(&global_ft, id);
- if (fp && fp->conn) {
+ if (fp && (fp->conn ||
+ (fp->durable_scavenger_timeout &&
+ (fp->durable_scavenger_timeout <
+ jiffies_to_msecs(jiffies))))) {
ksmbd_put_durable_fd(fp);
fp = NULL;
}
@@ -784,6 +787,10 @@ static bool session_fd_check(struct ksmbd_tree_connect *tcon,
fp->tcon = NULL;
fp->volatile_id = KSMBD_NO_FID;
+ if (fp->durable_timeout)
+ fp->durable_scavenger_timeout =
+ jiffies_to_msecs(jiffies) + fp->durable_timeout;
+
return true;
}
diff --git a/fs/smb/server/vfs_cache.h b/fs/smb/server/vfs_cache.h
index 5a225e7055f1..f2ab1514e81a 100644
--- a/fs/smb/server/vfs_cache.h
+++ b/fs/smb/server/vfs_cache.h
@@ -101,6 +101,7 @@ struct ksmbd_file {
struct list_head lock_list;
int durable_timeout;
+ int durable_scavenger_timeout;
/* if ls is happening on directory, below is valid*/
struct ksmbd_readdir_data readdir_data;
--
2.43.0
next prev parent reply other threads:[~2026-05-26 7:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 7:57 [PATCH 6.6.y v3 0/4] ksmbd: validate owner of durable handle on reconnect Alva Lan
2026-05-26 7:58 ` Alva Lan [this message]
[not found] ` <20260526075843.50277-1-alvalan9@foxmail.com>
2026-05-26 7:58 ` [PATCH 6.6.y v3 2/4] ksmbd: add durable scavenger timer Alva Lan
2026-05-26 7:58 ` [PATCH 6.6.y v3 3/4] ksmbd: validate owner of durable handle on reconnect Alva Lan
2026-05-26 7:58 ` [PATCH 6.6.y v3 4/4] ksmbd: close durable scavenger races against m_fp_list lookups Alva Lan
2026-05-26 13:38 ` [PATCH 6.6.y v3 0/4] ksmbd: validate owner of durable handle on reconnect Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_BBF2D52C7CD44B325AEFE16CC12C3444D00A@qq.com \
--to=alvalan9@foxmail.com \
--cc=charsyam@gmail.com \
--cc=d.ornaghi97@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=knavaneeth786@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=stfrench@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox