linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nsfs: simplify __ns_get_path
@ 2021-06-10  9:12 Chen Li
  0 siblings, 0 replies; only message in thread
From: Chen Li @ 2021-06-10  9:12 UTC (permalink / raw)
  To: Alexander Viro, linux-fsdevel, linux-kernel


d_make_root is enough here.

Signed-off-by: Chen Li <chenli@uniontech.com>
---
 fs/nsfs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/nsfs.c b/fs/nsfs.c
index 800c1d0eb0d0..702f485afbef 100644
--- a/fs/nsfs.c
+++ b/fs/nsfs.c
@@ -89,12 +89,10 @@ static int __ns_get_path(struct path *path, struct ns_common *ns)
 	inode->i_fop = &ns_file_operations;
 	inode->i_private = ns;
 
-	dentry = d_alloc_anon(mnt->mnt_sb);
+	dentry = d_make_root(inode);
 	if (!dentry) {
-		iput(inode);
 		return -ENOMEM;
 	}
-	d_instantiate(dentry, inode);
 	dentry->d_fsdata = (void *)ns->ops;
 	d = atomic_long_cmpxchg(&ns->stashed, 0, (unsigned long)dentry);
 	if (d) {
-- 
2.31.1




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-10  9:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10  9:12 [PATCH] nsfs: simplify __ns_get_path Chen Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).