Skip to content

Commit

Permalink
f2fs: remove false alarm on iget failure during GC
Browse files Browse the repository at this point in the history
[ Upstream commit 132e320 ]

This patch removes setting SBI_NEED_FSCK when GC gets an error on f2fs_iget,
since f2fs_iget can give ENOMEM and others by race condition.
If we set this critical fsck flag, we'll get EIO during fsync via the below
code path.

In f2fs_inplace_write_data(),

	if (is_sbi_flag_set(sbi, SBI_NEED_FSCK) || f2fs_cp_error(sbi)) {
		err = -EIO;
		goto drop_bio;
	}

Fixes: 9557727 ("f2fs: drop inplace IO if fs status is abnormal")
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Jaegeuk Kim authored and gregkh committed Jul 20, 2021
1 parent e882298 commit 63798e3
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions fs/f2fs/gc.c
Expand Up @@ -1450,10 +1450,8 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,

if (phase == 3) {
inode = f2fs_iget(sb, dni.ino);
if (IS_ERR(inode) || is_bad_inode(inode)) {
set_sbi_flag(sbi, SBI_NEED_FSCK);
if (IS_ERR(inode) || is_bad_inode(inode))
continue;
}

if (!down_write_trylock(
&F2FS_I(inode)->i_gc_rwsem[WRITE])) {
Expand Down

0 comments on commit 63798e3

Please sign in to comment.