Commit 98838579 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: fix error path of recovery

There are some places in where we missed to unlock page or unlock page
incorrectly, fix them.
Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 793ab1c8
...@@ -325,8 +325,10 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head, ...@@ -325,8 +325,10 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head,
break; break;
} }
if (!is_recoverable_dnode(page)) if (!is_recoverable_dnode(page)) {
f2fs_put_page(page, 1);
break; break;
}
if (!is_fsync_dnode(page)) if (!is_fsync_dnode(page))
goto next; goto next;
...@@ -338,8 +340,10 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head, ...@@ -338,8 +340,10 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head,
if (!check_only && if (!check_only &&
IS_INODE(page) && is_dent_dnode(page)) { IS_INODE(page) && is_dent_dnode(page)) {
err = f2fs_recover_inode_page(sbi, page); err = f2fs_recover_inode_page(sbi, page);
if (err) if (err) {
f2fs_put_page(page, 1);
break; break;
}
quota_inode = true; quota_inode = true;
} }
...@@ -355,6 +359,7 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head, ...@@ -355,6 +359,7 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head,
err = 0; err = 0;
goto next; goto next;
} }
f2fs_put_page(page, 1);
break; break;
} }
} }
...@@ -370,6 +375,7 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head, ...@@ -370,6 +375,7 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head,
"%s: detect looped node chain, " "%s: detect looped node chain, "
"blkaddr:%u, next:%u", "blkaddr:%u, next:%u",
__func__, blkaddr, next_blkaddr_of_node(page)); __func__, blkaddr, next_blkaddr_of_node(page));
f2fs_put_page(page, 1);
err = -EINVAL; err = -EINVAL;
break; break;
} }
...@@ -380,7 +386,6 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head, ...@@ -380,7 +386,6 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head,
f2fs_ra_meta_pages_cond(sbi, blkaddr); f2fs_ra_meta_pages_cond(sbi, blkaddr);
} }
f2fs_put_page(page, 1);
return err; return err;
} }
...@@ -666,8 +671,10 @@ static int recover_data(struct f2fs_sb_info *sbi, struct list_head *inode_list, ...@@ -666,8 +671,10 @@ static int recover_data(struct f2fs_sb_info *sbi, struct list_head *inode_list,
*/ */
if (IS_INODE(page)) { if (IS_INODE(page)) {
err = recover_inode(entry->inode, page); err = recover_inode(entry->inode, page);
if (err) if (err) {
f2fs_put_page(page, 1);
break; break;
}
} }
if (entry->last_dentry == blkaddr) { if (entry->last_dentry == blkaddr) {
err = recover_dentry(entry->inode, page, dir_list); err = recover_dentry(entry->inode, page, dir_list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment