From: John Garry <john.garry@linux.dev>
To: Tal Zussman <tz2294@columbia.edu>, Jens Axboe <axboe@kernel.dk>,
Christian Brauner <brauner@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 1/2] block: fail a short atomic bounce in bio_iov_iter_bounce_write()
Date: Sun, 8 Nov 2026 17:13:16 +0000 [thread overview]
Message-ID: <6bc16c54-a9f1-4c51-ab68-b227eeecaf66@linux.dev> (raw)
In-Reply-To: <20261107-blkdev-atomic-bounce-v1-1-f66344262096@columbia.edu>
On 11/8/26 04:24, Tal Zussman wrote:
> bio_iov_iter_get_pages() fails a REQ_ATOMIC bio that doesn't cover the
> whole iterator, since an atomic write is submitted as a single bio, and
> submitting only part of it would tear the write. In contrast,
> bio_iov_iter_bounce_write() doesn't. If a folio allocation fails partway
> through, it returns a short bio, which for an atomic write triggers a
> WARN_ON_ONCE() in iomap_dio_bio_iter_one().
>
> Make bio_iov_iter_bounce_write() also check that a REQ_ATOMIC bio covers
> the whole iterator, and clean up and return -EINVAL if it doesn't.
>
> Signed-off-by: Tal Zussman <tz2294@columbia.edu>
This looks reasonable, as atomic stable writes are implied to be
supported from 3373503df025a ("xfs: use bounce buffering direct I/O when
the device requires stable pages"). I am wondering how to test and prove
this (change is good and maintained)?
> ---
> block/bio.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/block/bio.c b/block/bio.c
> index b0fcc69de653..61a3812520a2 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -1523,6 +1523,16 @@ int bio_iov_iter_bounce_write(struct bio *bio, struct iov_iter *iter,
> }
> }
>
> + /*
> + * An atomic write is submitted as a single bio, so it has to cover
> + * the whole iterator or it would be torn.
> + */
> + if ((bio->bi_opf & REQ_ATOMIC) && iov_iter_count(iter)) {
> + iov_iter_revert(iter, total_copied);
> + bio_free_folios(bio);
> + return -EINVAL;
> + }
> +
> return 0;
> }
> EXPORT_SYMBOL_GPL(bio_iov_iter_bounce_write);
>
next prev parent reply other threads:[~2026-11-08 17:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-08 4:24 [PATCH 0/2] block: fail short atomic bounce bios " Tal Zussman
2026-11-08 4:24 ` [PATCH 1/2] block: fail a short atomic bounce " Tal Zussman
2026-11-08 17:13 ` John Garry [this message]
2026-11-08 4:24 ` [PATCH 2/2] iomap: remove the atomic write length check in iomap_dio_bio_iter_one() Tal Zussman
2026-11-08 17:06 ` John Garry
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=6bc16c54-a9f1-4c51-ab68-b227eeecaf66@linux.dev \
--to=john.garry@linux.dev \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®