Skip to content

Commit

Permalink
f2fs: set SBI_NEED_FSCK flag when inconsistent node block found
Browse files Browse the repository at this point in the history
Inconsistent node block will cause a file fail to open or read,
which could make the user process crashes or stucks. Let's mark
SBI_NEED_FSCK flag to trigger a fix at next fsck time. After
unlinking the corrupted file, the user process could regenerate
a new one and work correctly.

Signed-off-by: Weichao Guo <guoweichao@oppo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  • Loading branch information
weichao-guo authored and Jaegeuk Kim committed Sep 20, 2021
1 parent 287b140 commit 6663b13
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/f2fs/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -1443,6 +1443,7 @@ static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid,
nid, nid_of_node(page), ino_of_node(page),
ofs_of_node(page), cpver_of_node(page),
next_blkaddr_of_node(page));
set_sbi_flag(sbi, SBI_NEED_FSCK);
err = -EINVAL;
out_err:
ClearPageUptodate(page);
Expand Down

0 comments on commit 6663b13

Please sign in to comment.