BACKPORT: f2fs: fix to do sanity check on extent cache correctly

In do_read_inode(), sanity_check_inode() should be called after
f2fs_init_read_extent_tree(), fix it.

Fixes: 72840cccc0a1 ("f2fs: allocate the extent_cache by default")
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit d48a7b3a72f121655d95b5157c32c7d555e44c05)
[Lee: Removed call to f2fs_handle_error() - not in original hunk]
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I1a8695fc5eda522e010468093ad78ffebd7dada5
This commit is contained in:
Chao Yu 2023-01-09 11:49:20 +08:00 committed by Lee Jones
parent e95427763f
commit 3e9ba88034

View File

@ -401,11 +401,6 @@ static int do_read_inode(struct inode *inode)
fi->i_inline_xattr_size = 0;
}
if (!sanity_check_inode(inode, node_page)) {
f2fs_put_page(node_page, 1);
return -EFSCORRUPTED;
}
/* check data exist */
if (f2fs_has_inline_data(inode) && !f2fs_exist_data(inode))
__recover_inline_status(inode, node_page);
@ -472,6 +467,11 @@ static int do_read_inode(struct inode *inode)
f2fs_init_read_extent_tree(inode, node_page);
f2fs_init_age_extent_tree(inode);
if (!sanity_check_inode(inode, node_page)) {
f2fs_put_page(node_page, 1);
return -EFSCORRUPTED;
}
f2fs_put_page(node_page, 1);
stat_inc_inline_xattr(inode);