[f2fs-dev] [PATCH] f2fs: avoid setting SBI_NEED_FSCK on transient resize failure with -EAGAIN
Daeho Jeong <[email protected]>
| Newsgroups | net.sourceforge.lists.linux-f2fs-devel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
From: Daeho Jeong <[email protected]> When f2fs_resize_fs() fails due to transient lock contention or retryable GC failure in free_segment_range() returning -EAGAIN, no filesystem metadata has been modified on-disk yet. The filesystem remains completely consistent and clean. However, the current error recovery path unconditionally sets the SBI_NEED_FSCK flag on any error, forcing an unnecessary and time-consuming fsck.f2fs repair on the subsequent mount/reboot. Fix this by guarding set_sbi_flag(sbi, SBI_NEED_FSCK) with `if (err != -EAGAIN)`, avoiding false-positive filesystem corruption flags on transient resize retries. Signed-off-by: Daeho Jeong <[email protected]> Signed-off-by: Sunmin Jeong <[email protected]> --- fs/f2fs/gc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 192b16ac02f8..787133ee2eb2 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -2446,8 +2446,10 @@ int f2fs_resize_fs(struct file *filp, __u64 block_count) recover_out: clear_sbi_flag(sbi, SBI_IS_RESIZEFS); if (err) { - set_sbi_flag(sbi, SBI_NEED_FSCK); - f2fs_err(sbi, "resize_fs failed, should run fsck to repair!"); + if (err != -EAGAIN) { + set_sbi_flag(sbi, SBI_NEED_FSCK); + f2fs_err(sbi, "resize_fs failed, should run fsck to repair!"); + } spin_lock(&sbi->stat_lock); sbi->user_block_count += shrunk_blocks; -- 2.55.0.691.gc56d675ccc-goog _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel