From: Chen Li <chenli@uniontech.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] nsfs: simplify __ns_get_path
Date: Thu, 10 Jun 2021 17:12:37 +0800 [thread overview]
Message-ID: <874ke63wxm.wl-chenli@uniontech.com> (raw)
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
reply other threads:[~2021-06-10 9:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=874ke63wxm.wl-chenli@uniontech.com \
--to=chenli@uniontech.com \
--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;
as well as URLs for NNTP newsgroup(s).