* [PATCH] f2fs: stop checkpoint on compressed write IO error
@ 2026-05-25 6:14 Wenjie Qi
2026-05-26 2:14 ` Chao Yu
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Wenjie Qi @ 2026-05-25 6:14 UTC (permalink / raw)
To: jaegeuk, chao
Cc: yuchao0, linux-f2fs-devel, linux-kernel, qiwenjie, qwjhust, stable
Compressed data writes are accounted as F2FS_WB_CP_DATA because they
write compressed pages through fio->compressed_page. Their end_io path
should therefore have the same checkpoint-stop behavior as ordinary
F2FS_WB_CP_DATA writes.
However, f2fs_compress_write_end_io() only records -EIO in the inode
mapping when the bio fails. The filesystem can keep checkpointing after
that failure, so a later checkpoint may persist metadata that points to
compressed data blocks whose writeback failed.
Stop checkpointing with STOP_CP_REASON_WRITE_FAIL for failed compressed
F2FS_WB_CP_DATA writes, matching the ordinary data write end_io path.
Fixes: 4c8ff7095bef ("f2fs: support data compression")
Cc: stable@kernel.org
Signed-off-by: Wenjie Qi <qiwenjie@xiaomi.com>
---
fs/f2fs/compress.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index caf522d667d6..9b1501004456 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -1488,8 +1488,11 @@ void f2fs_compress_write_end_io(struct bio *bio, struct folio *folio)
f2fs_is_compressed_page(folio));
int i;
- if (unlikely(bio->bi_status != BLK_STS_OK))
+ if (unlikely(bio->bi_status != BLK_STS_OK)) {
mapping_set_error(cic->inode->i_mapping, -EIO);
+ if (type == F2FS_WB_CP_DATA)
+ f2fs_stop_checkpoint(sbi, true, STOP_CP_REASON_WRITE_FAIL);
+ }
f2fs_compress_free_page(page);
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] f2fs: stop checkpoint on compressed write IO error
2026-05-25 6:14 [PATCH] f2fs: stop checkpoint on compressed write IO error Wenjie Qi
@ 2026-05-26 2:14 ` Chao Yu
2026-06-15 15:30 ` [f2fs-dev] " patchwork-bot+f2fs
2026-06-15 20:24 ` Jaegeuk Kim
2 siblings, 0 replies; 6+ messages in thread
From: Chao Yu @ 2026-05-26 2:14 UTC (permalink / raw)
To: Wenjie Qi, jaegeuk
Cc: chao, yuchao0, linux-f2fs-devel, linux-kernel, qiwenjie, stable
On 5/25/26 14:14, Wenjie Qi wrote:
> Compressed data writes are accounted as F2FS_WB_CP_DATA because they
> write compressed pages through fio->compressed_page. Their end_io path
> should therefore have the same checkpoint-stop behavior as ordinary
> F2FS_WB_CP_DATA writes.
>
> However, f2fs_compress_write_end_io() only records -EIO in the inode
> mapping when the bio fails. The filesystem can keep checkpointing after
> that failure, so a later checkpoint may persist metadata that points to
> compressed data blocks whose writeback failed.
>
> Stop checkpointing with STOP_CP_REASON_WRITE_FAIL for failed compressed
> F2FS_WB_CP_DATA writes, matching the ordinary data write end_io path.
>
> Fixes: 4c8ff7095bef ("f2fs: support data compression")
> Cc: stable@kernel.org
> Signed-off-by: Wenjie Qi <qiwenjie@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [f2fs-dev] [PATCH] f2fs: stop checkpoint on compressed write IO error
2026-05-25 6:14 [PATCH] f2fs: stop checkpoint on compressed write IO error Wenjie Qi
2026-05-26 2:14 ` Chao Yu
@ 2026-06-15 15:30 ` patchwork-bot+f2fs
2026-06-15 20:24 ` Jaegeuk Kim
2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+f2fs @ 2026-06-15 15:30 UTC (permalink / raw)
To: Wenjie Qi
Cc: jaegeuk, chao, yuchao0, linux-kernel, linux-f2fs-devel, qiwenjie, stable
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:
On Mon, 25 May 2026 14:14:56 +0800 you wrote:
> Compressed data writes are accounted as F2FS_WB_CP_DATA because they
> write compressed pages through fio->compressed_page. Their end_io path
> should therefore have the same checkpoint-stop behavior as ordinary
> F2FS_WB_CP_DATA writes.
>
> However, f2fs_compress_write_end_io() only records -EIO in the inode
> mapping when the bio fails. The filesystem can keep checkpointing after
> that failure, so a later checkpoint may persist metadata that points to
> compressed data blocks whose writeback failed.
>
> [...]
Here is the summary with links:
- [f2fs-dev] f2fs: stop checkpoint on compressed write IO error
https://git.kernel.org/jaegeuk/f2fs/c/d99bb310a134
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [f2fs-dev] [PATCH] f2fs: stop checkpoint on compressed write IO error
2026-05-25 6:14 [PATCH] f2fs: stop checkpoint on compressed write IO error Wenjie Qi
2026-05-26 2:14 ` Chao Yu
2026-06-15 15:30 ` [f2fs-dev] " patchwork-bot+f2fs
@ 2026-06-15 20:24 ` Jaegeuk Kim
2026-06-16 13:04 ` Wenjie Qi
2 siblings, 1 reply; 6+ messages in thread
From: Jaegeuk Kim @ 2026-06-15 20:24 UTC (permalink / raw)
To: Wenjie Qi; +Cc: chao, yuchao0, linux-kernel, linux-f2fs-devel, qiwenjie, stable
On 05/25, Wenjie Qi wrote:
> Compressed data writes are accounted as F2FS_WB_CP_DATA because they
> write compressed pages through fio->compressed_page. Their end_io path
> should therefore have the same checkpoint-stop behavior as ordinary
> F2FS_WB_CP_DATA writes.
>
> However, f2fs_compress_write_end_io() only records -EIO in the inode
> mapping when the bio fails. The filesystem can keep checkpointing after
> that failure, so a later checkpoint may persist metadata that points to
> compressed data blocks whose writeback failed.
>
> Stop checkpointing with STOP_CP_REASON_WRITE_FAIL for failed compressed
> F2FS_WB_CP_DATA writes, matching the ordinary data write end_io path.
>
> Fixes: 4c8ff7095bef ("f2fs: support data compression")
> Cc: stable@kernel.org
> Signed-off-by: Wenjie Qi <qiwenjie@xiaomi.com>
> ---
> fs/f2fs/compress.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
> index caf522d667d6..9b1501004456 100644
> --- a/fs/f2fs/compress.c
> +++ b/fs/f2fs/compress.c
> @@ -1488,8 +1488,11 @@ void f2fs_compress_write_end_io(struct bio *bio, struct folio *folio)
> f2fs_is_compressed_page(folio));
> int i;
>
> - if (unlikely(bio->bi_status != BLK_STS_OK))
> + if (unlikely(bio->bi_status != BLK_STS_OK)) {
> mapping_set_error(cic->inode->i_mapping, -EIO);
> + if (type == F2FS_WB_CP_DATA)
It turns out the type should not be F2FS_WB_CP_DATA.
> + f2fs_stop_checkpoint(sbi, true, STOP_CP_REASON_WRITE_FAIL);
> + }
>
> f2fs_compress_free_page(page);
>
> --
> 2.43.0
>
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [f2fs-dev] [PATCH] f2fs: stop checkpoint on compressed write IO error
2026-06-15 20:24 ` Jaegeuk Kim
@ 2026-06-16 13:04 ` Wenjie Qi
2026-06-16 13:57 ` Wenjie Qi
0 siblings, 1 reply; 6+ messages in thread
From: Wenjie Qi @ 2026-06-16 13:04 UTC (permalink / raw)
To: Jaegeuk Kim
Cc: chao, yuchao0, linux-kernel, linux-f2fs-devel, qiwenjie, stable
I see. The old patch assumed compressed writeback should follow the
F2FS_WB_CP_DATA path because the current code accounts it that way.
After rechecking it, I agree that stopping checkpoint from this path
is not
the right fix.
I sent a separate patch to fix the accounting side instead:
f2fs: account compressed writeback by raw folio type
It derives the writeback count type from the raw pagecache folio, so normal
compressed writeback stays in F2FS_WB_DATA, while gcing/CP-guaranteed raw
folios still use F2FS_WB_CP_DATA.
On Tue, Jun 16, 2026 at 4:24 AM Jaegeuk Kim <jaegeuk@kernel.org> wrote:
>
> On 05/25, Wenjie Qi wrote:
> > Compressed data writes are accounted as F2FS_WB_CP_DATA because they
> > write compressed pages through fio->compressed_page. Their end_io path
> > should therefore have the same checkpoint-stop behavior as ordinary
> > F2FS_WB_CP_DATA writes.
> >
> > However, f2fs_compress_write_end_io() only records -EIO in the inode
> > mapping when the bio fails. The filesystem can keep checkpointing after
> > that failure, so a later checkpoint may persist metadata that points to
> > compressed data blocks whose writeback failed.
> >
> > Stop checkpointing with STOP_CP_REASON_WRITE_FAIL for failed compressed
> > F2FS_WB_CP_DATA writes, matching the ordinary data write end_io path.
> >
> > Fixes: 4c8ff7095bef ("f2fs: support data compression")
> > Cc: stable@kernel.org
> > Signed-off-by: Wenjie Qi <qiwenjie@xiaomi.com>
> > ---
> > fs/f2fs/compress.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
> > index caf522d667d6..9b1501004456 100644
> > --- a/fs/f2fs/compress.c
> > +++ b/fs/f2fs/compress.c
> > @@ -1488,8 +1488,11 @@ void f2fs_compress_write_end_io(struct bio *bio, struct folio *folio)
> > f2fs_is_compressed_page(folio));
> > int i;
> >
> > - if (unlikely(bio->bi_status != BLK_STS_OK))
> > + if (unlikely(bio->bi_status != BLK_STS_OK)) {
> > mapping_set_error(cic->inode->i_mapping, -EIO);
> > + if (type == F2FS_WB_CP_DATA)
>
> It turns out the type should not be F2FS_WB_CP_DATA.
>
> > + f2fs_stop_checkpoint(sbi, true, STOP_CP_REASON_WRITE_FAIL);
> > + }
> >
> > f2fs_compress_free_page(page);
> >
> > --
> > 2.43.0
> >
> >
> >
> > _______________________________________________
> > Linux-f2fs-devel mailing list
> > Linux-f2fs-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [f2fs-dev] [PATCH] f2fs: stop checkpoint on compressed write IO error
2026-06-16 13:04 ` Wenjie Qi
@ 2026-06-16 13:57 ` Wenjie Qi
0 siblings, 0 replies; 6+ messages in thread
From: Wenjie Qi @ 2026-06-16 13:57 UTC (permalink / raw)
To: Jaegeuk Kim
Cc: chao, yuchao0, linux-kernel, linux-f2fs-devel, qiwenjie, stable
https://lore.kernel.org/linux-f2fs-devel/20260616125219.1396871-1-qiwenjie@xiaomi.com/T/#u
On Tue, Jun 16, 2026 at 9:04 PM Wenjie Qi <qwjhust@gmail.com> wrote:
>
> I see. The old patch assumed compressed writeback should follow the
> F2FS_WB_CP_DATA path because the current code accounts it that way.
>
> After rechecking it, I agree that stopping checkpoint from this path
> is not
> the right fix.
>
> I sent a separate patch to fix the accounting side instead:
>
> f2fs: account compressed writeback by raw folio type
>
> It derives the writeback count type from the raw pagecache folio, so normal
> compressed writeback stays in F2FS_WB_DATA, while gcing/CP-guaranteed raw
> folios still use F2FS_WB_CP_DATA.
>
>
>
>
>
> On Tue, Jun 16, 2026 at 4:24 AM Jaegeuk Kim <jaegeuk@kernel.org> wrote:
> >
> > On 05/25, Wenjie Qi wrote:
> > > Compressed data writes are accounted as F2FS_WB_CP_DATA because they
> > > write compressed pages through fio->compressed_page. Their end_io path
> > > should therefore have the same checkpoint-stop behavior as ordinary
> > > F2FS_WB_CP_DATA writes.
> > >
> > > However, f2fs_compress_write_end_io() only records -EIO in the inode
> > > mapping when the bio fails. The filesystem can keep checkpointing after
> > > that failure, so a later checkpoint may persist metadata that points to
> > > compressed data blocks whose writeback failed.
> > >
> > > Stop checkpointing with STOP_CP_REASON_WRITE_FAIL for failed compressed
> > > F2FS_WB_CP_DATA writes, matching the ordinary data write end_io path.
> > >
> > > Fixes: 4c8ff7095bef ("f2fs: support data compression")
> > > Cc: stable@kernel.org
> > > Signed-off-by: Wenjie Qi <qiwenjie@xiaomi.com>
> > > ---
> > > fs/f2fs/compress.c | 5 ++++-
> > > 1 file changed, 4 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
> > > index caf522d667d6..9b1501004456 100644
> > > --- a/fs/f2fs/compress.c
> > > +++ b/fs/f2fs/compress.c
> > > @@ -1488,8 +1488,11 @@ void f2fs_compress_write_end_io(struct bio *bio, struct folio *folio)
> > > f2fs_is_compressed_page(folio));
> > > int i;
> > >
> > > - if (unlikely(bio->bi_status != BLK_STS_OK))
> > > + if (unlikely(bio->bi_status != BLK_STS_OK)) {
> > > mapping_set_error(cic->inode->i_mapping, -EIO);
> > > + if (type == F2FS_WB_CP_DATA)
> >
> > It turns out the type should not be F2FS_WB_CP_DATA.
> >
> > > + f2fs_stop_checkpoint(sbi, true, STOP_CP_REASON_WRITE_FAIL);
> > > + }
> > >
> > > f2fs_compress_free_page(page);
> > >
> > > --
> > > 2.43.0
> > >
> > >
> > >
> > > _______________________________________________
> > > Linux-f2fs-devel mailing list
> > > Linux-f2fs-devel@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-06-16 13:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-25 6:14 [PATCH] f2fs: stop checkpoint on compressed write IO error Wenjie Qi
2026-05-26 2:14 ` Chao Yu
2026-06-15 15:30 ` [f2fs-dev] " patchwork-bot+f2fs
2026-06-15 20:24 ` Jaegeuk Kim
2026-06-16 13:04 ` Wenjie Qi
2026-06-16 13:57 ` Wenjie Qi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome