From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD09E3BB66B for ; Wed, 19 Aug 2026 02:34:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787106866; cv=none; b=GzhKLOr63xrY4nw0as5rtyCBIwtofe01FxTpGWEc7Ah7oL7BMeCqR5nUTX0CIxpTASCyitWeZ+GrPRk2eOkegBZFRGlt5Ft1VR80dq57aWBXgfLZ2BSm6TmBRYLolM9wgbyIWFOYR6NNkSX96g3idF2PLWX6r0n8TLHi2mQfkXg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787106866; c=relaxed/simple; bh=fLZCYViwdsjFJ+ODSsOuNt5jkxnNq6vOAtYcWz6BM4I=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=QTXtWu2AcRvaF3/4Fiv+59XYvTNcUhtMT4ylLAenXIsB492+O8p/ePKmwe5DGbCR/2mNW2nx75NY1hBpgLhh+XWQ5+EEyZiDkS/oSpytq62em/jdlJVG0IzHGhv0omvvmtlFb4VqodvQVuQ2NaBq5FyQktu1IqziOMHoqgInMb4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=C2dOcBEk; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="C2dOcBEk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E1881F000E9; Wed, 19 Aug 2026 02:34:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1787106865; bh=8r4VBKabDA433cmhj+qWtxabqGu1maRWF+/47QrjGC4=; h=Date:Cc:Subject:To:References:From:In-Reply-To; b=C2dOcBEkfs6Niq415YM0S8ZoQ9wwAWO2+hueXbosYxRgqd/kvcmOtHTtC8iWkb23F 5s3bxZ2PQfYOSAvaDNKb/mxLOKmyPZggyLZceeEvGJ4sR+BO0VXIo5lttLHmfe4pGL tU0M0OFuLE8Jmh8w+F4GrI8AYN8TAT5Sayp+DPdkFCt6zPj4D3tT7xCIxcsxBrBLbk HytE2zm32kT1wAgkIw89OhWSueWadsbu8pEIUAGEnPZakxpM7K1sXeZ3sgfPAPxtH0 8u+PGdU6qRyrOTZm031cSHHQhUqsiM99vB6wQNXIpub1Mc/Ddvy9D24UTyHKbU1EEo DpO0+LW/SgJXA== Message-ID: <6b55a4e9-e4a0-421c-9bb6-98ffc2c915c9@kernel.org> Date: Wed, 19 Aug 2026 10:34:23 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: chao@kernel.org, Daeho Jeong Subject: Re: [f2fs-dev] [PATCH] f2fs: avoid setting SBI_NEED_FSCK on transient resize failure with -EAGAIN To: Daeho Jeong , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com References: <20260818170535.3190869-1-daeho43@gmail.com> Content-Language: en-US From: Chao Yu In-Reply-To: <20260818170535.3190869-1-daeho43@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 8/19/26 01:05, Daeho Jeong wrote: > From: Daeho Jeong > > 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 > Signed-off-by: Sunmin Jeong > --- > 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;