From: Chao Yu via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: Daeho Jeong <daeho43@gmail.com>,
linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com
Cc: Daeho Jeong <daehojeong@google.com>
Subject: Re: [f2fs-dev] [PATCH] f2fs: avoid setting SBI_NEED_FSCK on transient resize failure with -EAGAIN
Date: Wed, 19 Aug 2026 10:34:23 +0800 [thread overview]
Message-ID: <6b55a4e9-e4a0-421c-9bb6-98ffc2c915c9@kernel.org> (raw)
In-Reply-To: <20260818170535.3190869-1-daeho43@gmail.com>
On 8/19/26 01:05, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
>
> 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.
Any way to make sure EAGAIN is from free_segment_range(), in case we return
EAGAIN from 1) any other places that we may miss to check now or 2) we changed
the code to return EAGAIN in future.
Thanks,
>
> 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 <daehojeong@google.com>
> Signed-off-by: Sunmin Jeong <s_min.jeong@samsung.com>
> ---
> 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;
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
WARNING: multiple messages have this Message-ID (diff)
From: Chao Yu <chao@kernel.org>
To: Daeho Jeong <daeho43@gmail.com>,
linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com
Cc: chao@kernel.org, Daeho Jeong <daehojeong@google.com>
Subject: Re: [f2fs-dev] [PATCH] f2fs: avoid setting SBI_NEED_FSCK on transient resize failure with -EAGAIN
Date: Wed, 19 Aug 2026 10:34:23 +0800 [thread overview]
Message-ID: <6b55a4e9-e4a0-421c-9bb6-98ffc2c915c9@kernel.org> (raw)
In-Reply-To: <20260818170535.3190869-1-daeho43@gmail.com>
On 8/19/26 01:05, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
>
> 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.
Any way to make sure EAGAIN is from free_segment_range(), in case we return
EAGAIN from 1) any other places that we may miss to check now or 2) we changed
the code to return EAGAIN in future.
Thanks,
>
> 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 <daehojeong@google.com>
> Signed-off-by: Sunmin Jeong <s_min.jeong@samsung.com>
> ---
> 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;
next prev parent reply other threads:[~2026-08-19 2:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 17:05 [PATCH] f2fs: avoid setting SBI_NEED_FSCK on transient resize failure with -EAGAIN Daeho Jeong
2026-08-18 17:05 ` [f2fs-dev] " Daeho Jeong
2026-08-19 2:34 ` Chao Yu via Linux-f2fs-devel [this message]
2026-08-19 2:34 ` Chao Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6b55a4e9-e4a0-421c-9bb6-98ffc2c915c9@kernel.org \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=chao@kernel.org \
--cc=daeho43@gmail.com \
--cc=daehojeong@google.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.