All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tyler Hicks <tyhicks@linux.microsoft.com>
To: Eric Van Hensbergen <ericvh@gmail.com>,
	Latchesar Ionkov <lucho@ionkov.net>,
	Dominique Martinet <asmadeus@codewreck.org>
Cc: Christian Schoenebeck <linux_oss@crudebyte.com>,
	Jianyong Wu <jianyong.wu@arm.com>,
	v9fs-developer@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/5] 9p: Make the path walk logic more clear about when cloning is required
Date: Thu, 26 May 2022 19:00:01 -0500	[thread overview]
Message-ID: <20220527000003.355812-4-tyhicks@linux.microsoft.com> (raw)
In-Reply-To: <20220527000003.355812-1-tyhicks@linux.microsoft.com>

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.

Signed-off-by: Tyler Hicks <tyhicks@linux.microsoft.com>
---
 fs/9p/fid.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index dae276ca7f7a..dfe98a308612 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);
 		p9_client_clunk(old_fid);
 		if (IS_ERR(fid)) {
 			kfree(wnames);
@@ -230,7 +230,6 @@ static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry,
 		}
 		old_fid = fid;
 		i += l;
-		clone = 0;
 	}
 	kfree(wnames);
 fid_out:
-- 
2.25.1


  parent reply	other threads:[~2022-05-27  0:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-26 23:59 [PATCH v2 0/5] 9p: Fix refcounting and improve readability in lookup Tyler Hicks
2022-05-26 23:59 ` [PATCH v2 1/5] 9p: Fix refcounting during full path walks for fid lookups Tyler Hicks
2022-05-30 17:14   ` Christian Schoenebeck
2022-05-31 14:28     ` Tyler Hicks
2022-06-01 14:28       ` Christian Schoenebeck
2022-06-07  3:41         ` Tyler Hicks
2022-06-09 12:44           ` Christian Schoenebeck
2022-06-11 12:46             ` Dominique Martinet
2022-06-11 23:17   ` Dominique Martinet
2022-06-13 19:38     ` Tyler Hicks
2022-05-27  0:00 ` [PATCH v2 2/5] 9p: Track the root fid with its own variable during lookups Tyler Hicks
2022-05-27  0:00 ` Tyler Hicks [this message]
2022-05-27  0:00 ` [PATCH v2 4/5] 9p: Remove unnecessary variable for old fids while walking from d_parent Tyler Hicks
2022-05-27  0:00 ` [PATCH v2 5/5] 9p: Fix minor typo in code comment Tyler Hicks

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=20220527000003.355812-4-tyhicks@linux.microsoft.com \
    --to=tyhicks@linux.microsoft.com \
    --cc=asmadeus@codewreck.org \
    --cc=ericvh@gmail.com \
    --cc=jianyong.wu@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=lucho@ionkov.net \
    --cc=v9fs-developer@lists.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.