Skip to content

Commit fb7945b

Browse files
author
Al Viro
committed
nsfs: use d_make_root()
Normally d_make_root() is used to create the root dentry of superblock; here we use it for a different purpose, but... idiomatic or not, we need the same operation. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 9024b4c commit fb7945b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

fs/nsfs.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,9 @@ static int __ns_get_path(struct path *path, struct ns_common *ns)
9090
inode->i_fop = &ns_file_operations;
9191
inode->i_private = ns;
9292

93-
dentry = d_alloc_anon(mnt->mnt_sb);
94-
if (!dentry) {
95-
iput(inode);
93+
dentry = d_make_root(inode); /* not the normal use, but... */
94+
if (!dentry)
9695
return -ENOMEM;
97-
}
98-
d_instantiate(dentry, inode);
9996
dentry->d_fsdata = (void *)ns->ops;
10097
d = atomic_long_cmpxchg(&ns->stashed, 0, (unsigned long)dentry);
10198
if (d) {

0 commit comments

Comments
 (0)