Merge tag 'idmapped-mounts-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git...
[platform/kernel/linux-rpi.git] / fs / f2fs / namei.c
index c061a67..17bd072 100644 (file)
@@ -856,7 +856,11 @@ static int __f2fs_tmpfile(struct inode *dir, struct dentry *dentry,
 
        if (whiteout) {
                f2fs_i_links_write(inode, false);
+
+               spin_lock(&inode->i_lock);
                inode->i_state |= I_LINKABLE;
+               spin_unlock(&inode->i_lock);
+
                *whiteout = inode;
        } else {
                d_tmpfile(dentry, inode);
@@ -1043,7 +1047,11 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
                err = f2fs_add_link(old_dentry, whiteout);
                if (err)
                        goto put_out_dir;
+
+               spin_lock(&whiteout->i_lock);
                whiteout->i_state &= ~I_LINKABLE;
+               spin_unlock(&whiteout->i_lock);
+
                iput(whiteout);
        }