mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
f2fs: remove unnecessary f2fs_put_page in f2fs_rename
[1] changed the below condition, which made f2fs_put_page() voided.
This patch reapplies the AL's resolution in -next from [2].
- if (S_ISDIR(old_inode->i_mode)) {
+ if (old_is_dir && old_dir != new_dir) {
old_dir_entry = f2fs_parent_dir(old_inode, &old_dir_page);
if (!old_dir_entry) {
if (IS_ERR(old_dir_page))
[1] 7deee77b99 ("f2fs: Avoid reading renamed directory if parent does not change")
[2] https://lore.kernel.org/all/20231220013402.GW1674809@ZenIV/
Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
54be6c6c5a
commit
c10e8558d4
|
|
@ -1105,14 +1105,11 @@ static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
|||
iput(whiteout);
|
||||
}
|
||||
|
||||
if (old_is_dir) {
|
||||
if (old_dir_entry)
|
||||
f2fs_set_link(old_inode, old_dir_entry,
|
||||
old_dir_page, new_dir);
|
||||
else
|
||||
f2fs_put_page(old_dir_page, 0);
|
||||
if (old_dir_entry)
|
||||
f2fs_set_link(old_inode, old_dir_entry, old_dir_page, new_dir);
|
||||
if (old_is_dir)
|
||||
f2fs_i_links_write(old_dir, false);
|
||||
}
|
||||
|
||||
if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_STRICT) {
|
||||
f2fs_add_ino_entry(sbi, new_dir->i_ino, TRANS_DIR_INO);
|
||||
if (S_ISDIR(old_inode->i_mode))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user