[PATCH 1/4] fs: use path_equal() in fs_struct helpers

From: Christian Brauner

Date: Thu Mar 05 2026 - 16:06:18 EST


Replace the open-coded dentry/mnt pointer comparison in
put_fs_pwd_pool() with the existing path_equal() helper.

No functional change.

Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
---
fs/fs_struct.c | 2 +-
include/linux/fs_struct.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/fs_struct.c b/fs/fs_struct.c
index 43af98e0a10c..ce814b76bde7 100644
--- a/fs/fs_struct.c
+++ b/fs/fs_struct.c
@@ -50,7 +50,7 @@ void set_fs_pwd(struct fs_struct *fs, const struct path *path)

static inline int replace_path(struct path *p, const struct path *old, const struct path *new)
{
- if (likely(p->dentry != old->dentry || p->mnt != old->mnt))
+ if (likely(!path_equal(p, old)))
return 0;
*p = *new;
return 1;
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index f8cf3b280398..9414a572d8f2 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -57,7 +57,7 @@ static inline void get_fs_pwd_pool(struct fs_struct *fs, struct path *pwd)
static inline void put_fs_pwd_pool(struct fs_struct *fs, struct path *pwd)
{
read_seqlock_excl(&fs->seq);
- if ((fs->pwd.dentry == pwd->dentry) && (fs->pwd.mnt == pwd->mnt)) {
+ if (path_equal(&fs->pwd, pwd)) {
fs->pwd_refs++;
pwd = NULL;
}
--
2.47.3


--jqlkhartfnby3ev3
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="0002-fs-document-seqlock-usage-in-pwd-pool-APIs.patch"