Skip to content

Commit 3658840

Browse files
jankarabrauner
authored andcommitted
ext4: Remove ext4 locking of moved directory
Remove locking of moved directory in ext4_rename2(). We will take care of it in VFS instead. This effectively reverts commit 0813299 ("ext4: Fix possible corruption when moving a directory") and followup fixes. CC: Ted Tso <tytso@mit.edu> CC: stable@vger.kernel.org Signed-off-by: Jan Kara <jack@suse.cz> Message-Id: <20230601105830.13168-1-jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent f1fcbaa commit 3658840

1 file changed

Lines changed: 2 additions & 15 deletions

File tree

fs/ext4/namei.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3834,19 +3834,10 @@ static int ext4_rename(struct mnt_idmap *idmap, struct inode *old_dir,
38343834
return retval;
38353835
}
38363836

3837-
/*
3838-
* We need to protect against old.inode directory getting converted
3839-
* from inline directory format into a normal one.
3840-
*/
3841-
if (S_ISDIR(old.inode->i_mode))
3842-
inode_lock_nested(old.inode, I_MUTEX_NONDIR2);
3843-
38443837
old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de,
38453838
&old.inlined);
3846-
if (IS_ERR(old.bh)) {
3847-
retval = PTR_ERR(old.bh);
3848-
goto unlock_moved_dir;
3849-
}
3839+
if (IS_ERR(old.bh))
3840+
return PTR_ERR(old.bh);
38503841

38513842
/*
38523843
* Check for inode number is _not_ due to possible IO errors.
@@ -4043,10 +4034,6 @@ static int ext4_rename(struct mnt_idmap *idmap, struct inode *old_dir,
40434034
brelse(old.bh);
40444035
brelse(new.bh);
40454036

4046-
unlock_moved_dir:
4047-
if (S_ISDIR(old.inode->i_mode))
4048-
inode_unlock(old.inode);
4049-
40504037
return retval;
40514038
}
40524039

0 commit comments

Comments
 (0)