Skip to content

Commit

Permalink
ext4: Remove ext4 locking of moved directory
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jan Kara authored and Christian Brauner committed Jun 2, 2023
1 parent f1fcbaa commit 3658840
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions fs/ext4/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -3834,19 +3834,10 @@ static int ext4_rename(struct mnt_idmap *idmap, struct inode *old_dir,
return retval;
}

/*
* We need to protect against old.inode directory getting converted
* from inline directory format into a normal one.
*/
if (S_ISDIR(old.inode->i_mode))
inode_lock_nested(old.inode, I_MUTEX_NONDIR2);

old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de,
&old.inlined);
if (IS_ERR(old.bh)) {
retval = PTR_ERR(old.bh);
goto unlock_moved_dir;
}
if (IS_ERR(old.bh))
return PTR_ERR(old.bh);

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

unlock_moved_dir:
if (S_ISDIR(old.inode->i_mode))
inode_unlock(old.inode);

return retval;
}

Expand Down

0 comments on commit 3658840

Please sign in to comment.