Skip to contentSkip to conversation

nsfs: simplify __ns_get_path

PATCH New Chen Li 1 participant 1 message Jun 10, 2021 VFS

lore
Share & tools
lore

Chen Li

author
#0 lore raw

PATCH 1/1 nsfs: simplify __ns_get_path

d_make_root is enough here.

---
 fs/nsfs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/nsfs.c +1 -3
index 800c1d0eb0d0..702f485afbef 100644
@@ -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) {
Signature · 1 line
2.31.1