Skip to content

Commit 23cdee6

Browse files
committed
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 <aleksandr.mikhalitsyn@canonical.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent bda3f16 commit 23cdee6

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

fs/libfs.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2227,9 +2227,8 @@ int path_from_stashed(struct dentry **stashed, struct vfsmount *mnt, void *data,
22272227
if (IS_ERR(res))
22282228
return PTR_ERR(res);
22292229
if (res) {
2230-
path->dentry = res;
22312230
sops->put_data(data);
2232-
goto out_path;
2231+
goto make_path;
22332232
}
22342233

22352234
/* Allocate a new dentry. */
@@ -2246,15 +2245,14 @@ int path_from_stashed(struct dentry **stashed, struct vfsmount *mnt, void *data,
22462245
dput(dentry);
22472246
return PTR_ERR(res);
22482247
}
2249-
path->dentry = res;
2250-
/* A dentry was reused. */
22512248
if (res != dentry)
22522249
dput(dentry);
22532250

2254-
out_path:
2255-
WARN_ON_ONCE(path->dentry->d_fsdata != stashed);
2256-
WARN_ON_ONCE(d_inode(path->dentry)->i_private != data);
2251+
make_path:
2252+
path->dentry = res;
22572253
path->mnt = mntget(mnt);
2254+
VFS_WARN_ON_ONCE(path->dentry->d_fsdata != stashed);
2255+
VFS_WARN_ON_ONCE(d_inode(path->dentry)->i_private != data);
22582256
return 0;
22592257
}
22602258

0 commit comments

Comments
 (0)