Skip to content

Commit cde3c9d

Browse files
jankarabrauner
authored andcommitted
Revert "f2fs: fix potential corruption when moving a directory"
This reverts commit d947721. The locking is going to be provided by VFS. CC: Jaegeuk Kim <[email protected]> CC: [email protected] Signed-off-by: Jan Kara <[email protected]> Message-Id: <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 7517ce5 commit cde3c9d

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

fs/f2fs/namei.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -995,20 +995,12 @@ static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
995995
goto out;
996996
}
997997

998-
/*
999-
* Copied from ext4_rename: we need to protect against old.inode
1000-
* directory getting converted from inline directory format into
1001-
* a normal one.
1002-
*/
1003-
if (S_ISDIR(old_inode->i_mode))
1004-
inode_lock_nested(old_inode, I_MUTEX_NONDIR2);
1005-
1006998
err = -ENOENT;
1007999
old_entry = f2fs_find_entry(old_dir, &old_dentry->d_name, &old_page);
10081000
if (!old_entry) {
10091001
if (IS_ERR(old_page))
10101002
err = PTR_ERR(old_page);
1011-
goto out_unlock_old;
1003+
goto out;
10121004
}
10131005

10141006
if (S_ISDIR(old_inode->i_mode)) {
@@ -1116,9 +1108,6 @@ static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
11161108

11171109
f2fs_unlock_op(sbi);
11181110

1119-
if (S_ISDIR(old_inode->i_mode))
1120-
inode_unlock(old_inode);
1121-
11221111
if (IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir))
11231112
f2fs_sync_fs(sbi->sb, 1);
11241113

@@ -1133,9 +1122,6 @@ static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
11331122
f2fs_put_page(old_dir_page, 0);
11341123
out_old:
11351124
f2fs_put_page(old_page, 0);
1136-
out_unlock_old:
1137-
if (S_ISDIR(old_inode->i_mode))
1138-
inode_unlock(old_inode);
11391125
out:
11401126
iput(whiteout);
11411127
return err;

0 commit comments

Comments
 (0)