All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Wenjie Qi" <qwjhust@gmail.com>, jaegeuk@kernel.org, chao@kernel.org
Cc: hch@lst.de, jack@suse.cz, axboe@kernel.dk, tz2294@columbia.edu,
	baohua@kernel.org, linux-mm@kvack.org, qiwenjie@xiaomi.com
Subject: Re: [PATCH v6 1/2] f2fs: complete dropbehind write bios in task context
Date: Sat, 28 Nov 2026 08:49:17 +0000	[thread overview]
Message-ID: <sashiko-outbox-238562@kernel.org> (raw)
In-Reply-To: <323235fbdeb5131f83569541c602ddc88f412b18.1795746008.git.qiwenjie@xiaomi.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] f2fs: missed BIO_COMPLETE_IN_TASK for compressed writes in
  __bio_alloc()
--

commit eb035ab3b21d7c6d735daa2773a956fd37b6e545
Author: Wenjie Qi <qwjhust@gmail.com>

f2fs: complete dropbehind write bios in task context

This commit sets BIO_COMPLETE_IN_TASK on write bios containing dropbehind
folios so that bio completion is deferred to task context where the folios
can be invalidated.

> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index cdc9e6e8633c8..37d74afc8b26a 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -624,6 +624,9 @@ static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages)
>  	bio = bio_alloc_bioset(bdev, npages,
>  				fio->op | fio->op_flags | f2fs_io_flags(fio),
>  				GFP_NOIO, &f2fs_bioset);
> +	if (!is_read_io(fio->op) && !fio->is_cache &&
> +	    folio_test_dropbehind(fio->folio))
> +		bio_set_flag(bio, BIO_COMPLETE_IN_TASK);
>  	bio->bi_iter.bi_sector = sector;
>  	F2FS_BIO(bio)->entry = NULL;
>  	bio->bi_private = NULL;

[ ... ]

> @@ -1359,6 +1364,8 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)
>  		__submit_merged_bio(io);
>  		goto alloc_new;
>  	}
> +	if (folio_test_dropbehind(fio->folio))
> +		bio_set_flag(io->bio, BIO_COMPLETE_IN_TASK);
>  
>  	F2FS_BIO(io->bio)->entry_cnt++;

[Severity: Medium]
Can compressed cluster write bios miss BIO_COMPLETE_IN_TASK when only
fio->folio is checked?

In f2fs_write_compressed_pages(), the cluster submission loop skips
f2fs_outplace_write_data() for the cluster header (i == 0) and any block
index past cc->valid_nr_cblocks:

fs/f2fs/compress.c:f2fs_write_compressed_pages() {
	...
		if (i == 0) {
			...
			goto unlock_continue;
		}
		...
		if (i > cc->valid_nr_cblocks) {
			...
			goto unlock_continue;
		}
	...
}

As a result, cc->rpages[0] and trailing raw folios in cc->rpages[] beyond
cc->valid_nr_cblocks are never passed as fio->folio to
f2fs_submit_page_write() or __bio_alloc().  On completion,
f2fs_compress_write_end_io() calls folio_end_writeback() on all raw folios
in cic->rpages[] when the last compressed block in cic->pending_blocks
finishes.

If PG_dropbehind is set on one of those unsubmitted raw folios (or if a
compressed cluster spans multiple bios and the last bio to complete was not
marked), f2fs_compress_write_end_io() runs in atomic context and
folio_end_dropbehind() skips invalidating the cluster's dropbehind folios.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1795746008.git.qiwenjie@xiaomi.com?part=1


  reply	other threads:[~2026-11-28  8:49 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03 12:59 [PATCH v4 0/2] f2fs: enable buffered RWF_DONTCACHE Wenjie Qi
2026-09-03 12:59 ` [f2fs-dev] " Wenjie Qi
2026-09-03 12:59 ` [PATCH v4 1/2] f2fs: complete dropbehind write bios in task context Wenjie Qi
2026-09-03 12:59   ` [f2fs-dev] " Wenjie Qi
2026-09-04 22:35   ` Tal Zussman
2026-09-04 22:35     ` [f2fs-dev] " Tal Zussman
2026-09-03 12:59 ` [PATCH v4 2/2] f2fs: enable buffered RWF_DONTCACHE Wenjie Qi
2026-09-03 12:59   ` [f2fs-dev] " Wenjie Qi
2026-09-05  7:07 ` [syzbot ci] " syzbot ci
2026-09-05  7:07   ` [f2fs-dev] " syzbot ci
2026-09-05 13:29   ` [PATCH] f2fs: handle NULL kiocb in write_begin Wenjie Qi
2026-09-05 13:29     ` [f2fs-dev] " Wenjie Qi
2026-09-05 14:09     ` [syzbot ci] " syzbot ci
2026-09-05 14:26     ` [syzbot ci] Re: f2fs: enable buffered RWF_DONTCACHE syzbot ci
2026-09-05 14:26       ` [f2fs-dev] " syzbot ci
2026-09-08  3:55 ` [PATCH v5 0/2] " Wenjie Qi
2026-09-08  3:55   ` [f2fs-dev] " Wenjie Qi
2026-09-08  3:55   ` [PATCH v5 1/2] f2fs: complete dropbehind write bios in task context Wenjie Qi
2026-09-08  3:55     ` [f2fs-dev] " Wenjie Qi
2026-09-08  3:55   ` [PATCH v5 2/2] f2fs: enable buffered RWF_DONTCACHE Wenjie Qi
2026-09-08  3:55     ` [f2fs-dev] " Wenjie Qi
2026-09-15  1:57   ` [f2fs-dev] [PATCH v5 0/2] " Wenjie Qi
2026-09-15  1:57     ` Wenjie Qi
2026-11-27  8:48   ` [PATCH v6 " Wenjie Qi
2026-11-27  8:48     ` [f2fs-dev] " Wenjie Qi
2026-11-27  8:48     ` [PATCH v6 1/2] f2fs: complete dropbehind write bios in task context Wenjie Qi
2026-11-27  8:48       ` [f2fs-dev] " Wenjie Qi
2026-11-28  8:49       ` sashiko-bot [this message]
2026-11-27  8:48     ` [PATCH v6 2/2] f2fs: enable buffered RWF_DONTCACHE Wenjie Qi
2026-11-27  8:48       ` [f2fs-dev] " Wenjie Qi
2026-11-28  8:49       ` sashiko-bot

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=sashiko-outbox-238562@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=baohua@kernel.org \
    --cc=chao@kernel.org \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=jaegeuk@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=qiwenjie@xiaomi.com \
    --cc=qwjhust@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tz2294@columbia.edu \
    /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.