ramfs: skip mknod if inode already exists.
PATCH 1/1 ramfs: skip mknod if inode already exists.
It's possible we try to mknod a dentry, which have already bound to an inode, just skip it.
--- fs/ramfs/inode.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ramfs/inode.c +2 -0
@@ -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);
Signature · 1 line
2.32.0
Quoted 3 lines · Chen Li
It's possible we try to mknod a dentry, which have already bound to an inode, just skip it.
How do you think this could happen?
Re: [PATCH] ramfs: skip mknod if inode already exists.【请注意,邮件由batv+ae8989e1668f84a74d37+6506+infradead.org+hch@casper.srs.infradead.org代发】
Quoted 9 lines · Christoph Hellwig
Quoted 3 lines · Chen Li
It's possible we try to mknod a dentry, which have already bound to an inode, just skip it.
How do you think this could happen?
Sorry, that's my bad. I noticed unionfs used to do this check in 9c5b4452998c6e670cfde0928b277e9c50d9a676, but not sure is it a must.
Al Viro
maintainerQuoted 3 lines · Chen Li
It's possible we try to mknod a dentry, which have already bound to an inode, just skip it.
Caller should have checked may_create(), which includes EEXIST handling.
Incidentally, if it ever had been called that way, your variant would leak inode. Not the main problem, though...
Re: [PATCH] ramfs: skip mknod if inode already exists.【请注意,邮件由[email protected]代发】
Quoted 8 lines · Al Viro
Quoted 3 lines · Chen Li
It's possible we try to mknod a dentry, which have already bound to an inode, just skip it.
Caller should have checked
may_create(), which includes EEXIST handling.NAKed-by Al Viro <[email protected]>
Don't know may_create before, thanks!
Quoted 5 lines
Incidentally, if it ever had been called that way, your variant would leak inode. Not the main problem, though...