summaryrefslogtreecommitdiff
path: root/fs/9p
diff options
context:
space:
mode:
authorTyler Hicks <tyhicks@linux.microsoft.com>2022-05-26 19:00:01 -0500
committerDominique Martinet <dominique.martinet@atmark-techno.com>2022-07-02 18:52:21 +0900
commitc58c72d301d3d16ba1167d56417af39761829030 (patch)
tree8117c84e87e8f6167eb1137e230dc8782f641626 /fs/9p
parentcba83f47fc0ef52638870890e9e352afcc56dd73 (diff)
9p: Make the path walk logic more clear about when cloning is required
Cloning during a path component walk is only needed when the old fid used for the walk operation is the root fid. Make that clear by comparing the two fids rather than using an additional variable. Link: https://lkml.kernel.org/r/20220527000003.355812-4-tyhicks@linux.microsoft.com Signed-off-by: Tyler Hicks <tyhicks@linux.microsoft.com> Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Diffstat (limited to 'fs/9p')
-rw-r--r--fs/9p/fid.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index 056b2a7e1964..e9cea696329f 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -150,7 +150,7 @@ static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry,
{
struct dentry *ds;
const unsigned char **wnames, *uname;
- int i, n, l, clone, access;
+ int i, n, l, access;
struct v9fs_session_info *v9ses;
struct p9_fid *fid, *root_fid, *old_fid;
@@ -214,7 +214,6 @@ static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry,
}
fid = root_fid;
old_fid = root_fid;
- clone = 1;
i = 0;
while (i < n) {
l = min(n - i, P9_MAXWELEM);
@@ -222,7 +221,8 @@ static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry,
* We need to hold rename lock when doing a multipath
* walk to ensure none of the patch component change
*/
- fid = p9_client_walk(old_fid, l, &wnames[i], clone);
+ fid = p9_client_walk(old_fid, l, &wnames[i],
+ old_fid == root_fid /* clone */);
/* non-cloning walk will return the same fid */
if (fid != old_fid) {
p9_client_clunk(old_fid);
@@ -233,7 +233,6 @@ static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry,
goto err_out;
}
i += l;
- clone = 0;
}
kfree(wnames);
fid_out: