From 23cdee615c4fdad1a8ec6f317b3c294cb37d662d Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Wed, 18 Jun 2025 22:53:37 +0200 Subject: [PATCH] libfs: massage path_from_stashed() Make it a littler easier to follow. Link: https://lore.kernel.org/20250618-work-pidfs-persistent-v2-3-98f3456fd552@kernel.org Reviewed-by: Alexander Mikhalitsyn Signed-off-by: Christian Brauner --- fs/libfs.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index 3541e22c87b5..997d3a363ce6 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -2227,9 +2227,8 @@ int path_from_stashed(struct dentry **stashed, struct vfsmount *mnt, void *data, if (IS_ERR(res)) return PTR_ERR(res); if (res) { - path->dentry = res; sops->put_data(data); - goto out_path; + goto make_path; } /* Allocate a new dentry. */ @@ -2246,15 +2245,14 @@ int path_from_stashed(struct dentry **stashed, struct vfsmount *mnt, void *data, dput(dentry); return PTR_ERR(res); } - path->dentry = res; - /* A dentry was reused. */ if (res != dentry) dput(dentry); -out_path: - WARN_ON_ONCE(path->dentry->d_fsdata != stashed); - WARN_ON_ONCE(d_inode(path->dentry)->i_private != data); +make_path: + path->dentry = res; path->mnt = mntget(mnt); + VFS_WARN_ON_ONCE(path->dentry->d_fsdata != stashed); + VFS_WARN_ON_ONCE(d_inode(path->dentry)->i_private != data); return 0; } -- 2.25.1