summaryrefslogtreecommitdiffstats
path: root/fs/overlayfs
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2018-08-22 10:55:22 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-22 22:15:25 +0200
commit6faf05c2b2b4fe70d9068067437649401531de0a (patch)
tree11013bae190f6188a45c62db96a3975a68863e26 /fs/overlayfs
parentMerge branch 'akpm' (patches from Andrew) (diff)
downloadlinux-6faf05c2b2b4fe70d9068067437649401531de0a.tar.xz
linux-6faf05c2b2b4fe70d9068067437649401531de0a.zip
ovl: set I_CREATING on inode being created
...otherwise there will be list corruption due to inode_sb_list_add() being called for inode already on the sb list. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Fixes: e950564b97fd ("vfs: don't evict uninitialized inode") Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/overlayfs')
-rw-r--r--fs/overlayfs/dir.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index ec350d4d921c..276914ae3c60 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -603,6 +603,10 @@ static int ovl_create_object(struct dentry *dentry, int mode, dev_t rdev,
if (!inode)
goto out_drop_write;
+ spin_lock(&inode->i_lock);
+ inode->i_state |= I_CREATING;
+ spin_unlock(&inode->i_lock);
+
inode_init_owner(inode, dentry->d_parent->d_inode, mode);
attr.mode = inode->i_mode;