ovl: set I_CREATING on inode being created
authorMiklos Szeredi <miklos@szeredi.hu>
Wed, 22 Aug 2018 08:55:22 +0000 (10:55 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 22 Aug 2018 20:15:25 +0000 (13:15 -0700)
...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>
fs/overlayfs/dir.c

index ec350d4d921cf730eb975501d4799070393b81d9..276914ae3c60aaf297747f03b58d4582df335ec9 100644 (file)
@@ -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;