From: Chen Li <chenli@uniontech.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Christian Brauner <christian.brauner@ubuntu.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH] ramfs: skip mknod if inode already exists.
Date: Wed, 16 Jun 2021 10:53:12 +0800 [thread overview]
Message-ID: <874kdyh65j.wl-chenli@uniontech.com> (raw)
It's possible we try to mknod a dentry, which have
already bound to an inode, just skip it.
Signed-off-by: Chen Li <chenli@uniontech.com>
---
fs/ramfs/inode.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index 9ebd17d7befb..6cb1de521142 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -106,6 +106,8 @@ ramfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
{
struct inode * inode = ramfs_get_inode(dir->i_sb, dir, mode, dev);
int error = -ENOSPC;
+ if (dentry->d_inode)
+ return -EEXIST;
if (inode) {
d_instantiate(dentry, inode);
--
2.32.0
next reply other threads:[~2021-06-16 2:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-16 2:53 Chen Li [this message]
2021-06-16 5:10 ` [PATCH] ramfs: skip mknod if inode already exists Christoph Hellwig
2021-06-16 8:11 ` [PATCH] ramfs: skip mknod if inode already exists.【请注意,邮件由batv+ae8989e1668f84a74d37+6506+infradead.org+hch@casper.srs.infradead.org代发】 Chen Li
2021-06-16 12:16 ` [PATCH] ramfs: skip mknod if inode already exists Al Viro
2021-06-17 1:13 ` [PATCH] ramfs: skip mknod if inode already exists.【请注意,邮件由viro@ftp.linux.org.uk代发】 Chen Li
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=874kdyh65j.wl-chenli@uniontech.com \
--to=chenli@uniontech.com \
--cc=akpm@linux-foundation.org \
--cc=christian.brauner@ubuntu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.