mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mateusz Guzik <mjguzik@gmail.com>
To: brauner@kernel.org
Cc: viro@zeniv.linux.org.uk, jack@suse.cz,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Mateusz Guzik <mjguzik@gmail.com>
Subject: [PATCH 10/10] nfsd: use path_clone()
Date: Sun, 13 Sep 2026 16:49:17 +0200	[thread overview]
Message-ID: <20260913144918.1606123-11-mjguzik@gmail.com> (raw)
In-Reply-To: <20260913144918.1606123-1-mjguzik@gmail.com>

No functional changes.

Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
---
 fs/nfsd/export.c  | 6 ++----
 fs/nfsd/nfs4xdr.c | 8 ++++----
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index e5a0f1ababe6..84ea833816b5 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -233,8 +233,7 @@ static inline void expkey_update(struct cache_head *cnew,
 	struct svc_expkey *new = container_of(cnew, struct svc_expkey, h);
 	struct svc_expkey *item = container_of(citem, struct svc_expkey, h);
 
-	new->ek_path = item->ek_path;
-	path_get(&item->ek_path);
+	path_clone(&item->ek_path, &new->ek_path);
 }
 
 static struct cache_head *expkey_alloc(void)
@@ -1533,8 +1532,7 @@ static void svc_export_init(struct cache_head *cnew, struct cache_head *citem)
 
 	kref_get(&item->ex_client->ref);
 	new->ex_client = item->ex_client;
-	new->ex_path = item->ex_path;
-	path_get(&item->ex_path);
+	path_clone(&item->ex_path, &new->ex_path);
 	new->ex_fslocs.locations = NULL;
 	new->ex_fslocs.locations_count = 0;
 	new->ex_fslocs.migrated = 0;
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 7d1b2d6f57f2..65a805501b75 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2966,14 +2966,14 @@ static __be32 nfsd4_encode_pathname4(struct xdr_stream *xdr,
 				     const struct path *root,
 				     const struct path *path)
 {
-	struct path cur = *path;
+	struct path cur;
 	struct dentry **components = NULL;
 	unsigned int ncomponents = 0;
 	__be32 err = nfserr_jukebox;
 
 	dprintk("nfsd4_encode_components(");
 
-	path_get(&cur);
+	path_clone(path, &cur);
 	/* First walk the path up to the nfsd root, and store the
 	 * dentries/path components in an array.
 	 */
@@ -3216,11 +3216,11 @@ static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *bmval2, u32
 
 static int nfsd4_get_mounted_on_ino(struct svc_export *exp, u64 *pino)
 {
-	struct path path = exp->ex_path;
+	struct path path;
 	struct kstat stat;
 	int err;
 
-	path_get(&path);
+	path_clone(&exp->ex_path, &path);
 	while (follow_up(&path)) {
 		if (path.dentry != path.mnt->mnt_root)
 			break;
-- 
2.53.0


  parent reply	other threads:[~2026-09-13 14:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-13 14:49 [PATCH 00/10] Towards safer path_* API Mateusz Guzik
2026-09-13 14:49 ` [PATCH 01/10] fs: unexport backing_file_set_user_path() and make it take the ref on its own Mateusz Guzik
2026-09-14  8:33   ` Jan Kara
2026-09-14 23:41   ` NeilBrown
2026-09-13 14:49 ` [PATCH 02/10] fs: add path_create(), path_move() and path_clone() Mateusz Guzik
2026-09-13 14:51   ` Mateusz Guzik
2026-09-14 23:46   ` NeilBrown
2026-09-15  0:05   ` NeilBrown
2026-09-15  0:10     ` NeilBrown
2026-09-13 14:49 ` [PATCH 03/10] fs: use path_clone() in path_init() Mateusz Guzik
2026-09-14 23:52   ` NeilBrown
2026-09-13 14:49 ` [PATCH 04/10] fs: use path_clone() and path_move() in vfs_open* Mateusz Guzik
2026-09-14  8:56   ` Jan Kara
2026-09-13 14:49 ` [PATCH 05/10] fs: use path_clone() in backing_file_set_user_path() Mateusz Guzik
2026-09-14  8:57   ` Jan Kara
2026-09-13 14:49 ` [PATCH 06/10] Coccinelle-based conversion of path_* consumers to use the new primitives Mateusz Guzik
2026-09-14  8:57   ` Jan Kara
2026-09-13 14:49 ` [PATCH 07/10] autofs: use path_create() Mateusz Guzik
2026-09-14  8:58   ` Jan Kara
2026-09-13 14:49 ` [PATCH 08/10] fsnotify: use path_clone() Mateusz Guzik
2026-09-14  8:36   ` Jan Kara
2026-09-13 14:49 ` [PATCH 09/10] proc: " Mateusz Guzik
2026-09-14  8:58   ` Jan Kara
2026-09-13 14:49 ` Mateusz Guzik [this message]
2026-09-14  9:01   ` [PATCH 10/10] nfsd: " Jan Kara
2026-09-14  8:53 ` [PATCH 00/10] Towards safer path_* API Jan Kara
2026-09-14 23:36 ` NeilBrown

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=20260913144918.1606123-11-mjguzik@gmail.com \
    --to=mjguzik@gmail.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®