Skip to contentSkip to conversation

f2fs: remove false alarm on iget failure during GC

PATCH In review Jaegeuk Kim 2 participants 2 messages Jun 22, 2021 – Jun 28, 2021 F2FS file system

lore
Share & tools
lore

Jaegeuk Kim

author maintainer
#0 lore raw

PATCH 1/1 f2fs: remove false alarm on iget failure during GC

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 9557727876674 ("f2fs: drop inplace IO if fs status is abnormal")
---
 fs/f2fs/gc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/f2fs/gc.c +1 -3
index da5947b30142..0e42ee5f7770 100644
@@ -1451,10 +1451,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])) {
Signature · 1 line
2.32.0.288.g62a8d224e6-goog
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jaegeuk Kim

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(),

Quoted 7 lines
	if (is_sbi_flag_set(sbi, SBI_NEED_FSCK) || f2fs_cp_error(sbi)) {
		err = -EIO;
		goto drop_bio;
	}
Fixes 9557727876674 ("f2fs: drop inplace IO if fs status is abnormal")

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel