summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorChao Yu <chao@kernel.org>2023-01-09 11:49:20 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2023-01-31 10:47:45 -0800
commitd48a7b3a72f121655d95b5157c32c7d555e44c05 (patch)
treefd16f0a18738687e624ae0525219ea482d5cb24f /fs/f2fs
parent71a298ca208e48bd69e1bf61a22a762624885093 (diff)
downloadlinux-d48a7b3a72f121655d95b5157c32c7d555e44c05.tar.gz
linux-d48a7b3a72f121655d95b5157c32c7d555e44c05.tar.bz2
linux-d48a7b3a72f121655d95b5157c32c7d555e44c05.zip
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>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/inode.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index 01b9e6f85f6b..fd2ee5554985 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -413,12 +413,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);
- f2fs_handle_error(sbi, ERROR_CORRUPTED_INODE);
- return -EFSCORRUPTED;
- }
-
/* check data exist */
if (f2fs_has_inline_data(inode) && !f2fs_exist_data(inode))
__recover_inline_status(inode, node_page);
@@ -482,6 +476,12 @@ 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);
+ f2fs_handle_error(sbi, ERROR_CORRUPTED_INODE);
+ return -EFSCORRUPTED;
+ }
+
f2fs_put_page(node_page, 1);
stat_inc_inline_xattr(inode);