From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Henrique Carvalho <henrique.carvalho@suse.com>,
Enzo Matsumiya <ematsumiya@suse.de>,
Steve French <stfrench@microsoft.com>,
Sasha Levin <sashal@kernel.org>,
sfrench@samba.org, linux-cifs@vger.kernel.org,
samba-technical@lists.samba.org
Subject: [PATCH AUTOSEL 6.17] smb: client: update cfid->last_access_time in open_cached_dir_by_dentry()
Date: Sat, 25 Oct 2025 12:00:48 -0400 [thread overview]
Message-ID: <20251025160905.3857885-417-sashal@kernel.org> (raw)
In-Reply-To: <20251025160905.3857885-1-sashal@kernel.org>
From: Henrique Carvalho <henrique.carvalho@suse.com>
[ Upstream commit 5676398315b73f21d6a4e2d36606ce94e8afc79e ]
open_cached_dir_by_dentry() was missing an update of
cfid->last_access_time to jiffies, similar to what open_cached_dir()
has.
Add it to the function.
Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
Reviewed-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
YES
- The change makes `open_cached_dir_by_dentry()` refresh
`cfid->last_access_time` just like `open_cached_dir()` already does,
so cached handles looked up by dentry stay marked as recently used
(`fs/smb/client/cached_dir.c:430`, compare with
`fs/smb/client/cached_dir.c:197`). Without this, directories accessed
through this path age out after the default 30 s timeout
(`fs/smb/client/cifsfs.c:120`) regardless of activity.
- Eviction is driven by `cfids_laundromat_worker()`, which examines
`last_access_time` to drop “stale” entries
(`fs/smb/client/cached_dir.c:747-759`). Because lookups and
revalidation frequently reach the cache via
`open_cached_dir_by_dentry()` (`fs/smb/client/inode.c:2706` and
`fs/smb/client/dir.c:732`), the missing update causes active
directories to be torn down prematurely, forcing unnecessary reopen
traffic and defeating the regression fix that introduced the field.
- The bug was introduced when `last_access_time` was added
(`3edc68de5629`, included in v6.17), so affected stable trees already
carry the infrastructure this patch relies on. The fix itself is a
single assignment under the existing spinlock, so the regression risk
is negligible and no additional prerequisites are required.
fs/smb/client/cached_dir.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/smb/client/cached_dir.c b/fs/smb/client/cached_dir.c
index b69daeb1301b3..cc857a030a778 100644
--- a/fs/smb/client/cached_dir.c
+++ b/fs/smb/client/cached_dir.c
@@ -423,6 +423,7 @@ int open_cached_dir_by_dentry(struct cifs_tcon *tcon,
cifs_dbg(FYI, "found a cached file handle by dentry\n");
kref_get(&cfid->refcount);
*ret_cfid = cfid;
+ cfid->last_access_time = jiffies;
spin_unlock(&cfids->cfid_list_lock);
return 0;
}
--
2.51.0
prev parent reply other threads:[~2025-10-25 16:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20251025160905.3857885-1-sashal@kernel.org>
2025-10-25 15:55 ` [PATCH AUTOSEL 6.17-6.1] ksmbd: use sock_create_kern interface to create kernel socket Sasha Levin
2025-10-25 16:00 ` [PATCH AUTOSEL 6.17-6.1] smb: client: transport: avoid reconnects triggered by pending task work Sasha Levin
2025-10-25 16:00 ` Sasha Levin [this message]
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=20251025160905.3857885-417-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=ematsumiya@suse.de \
--cc=henrique.carvalho@suse.com \
--cc=linux-cifs@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=samba-technical@lists.samba.org \
--cc=sfrench@samba.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).