linux-next: manual merge of the block tree with the mm tree

From: Mark Brown

Date: Tue Oct 20 2026 - 08:32:54 EST


Hi all,

Today's linux-next merge of the block tree got a conflict in:

block/bio.c

between commit:

d4ee6948bcabb ("block: restore the iterator when rejecting a misaligned bio")

from the mm tree and commit:

73a0ff6030afc ("block: fail a short atomic pin in bio_iov_iter_get_pages()")

from the block tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

diff --cc block/bio.c
index f5f866bfd89e4,8b3f6dc075275..0000000000000
--- a/block/bio.c
+++ b/block/bio.c
@@@ -1308,7 -1345,7 +1345,8 @@@ int bio_iov_iter_get_pages(struct bio *
unsigned len_align_mask)
{
iov_iter_extraction_t flags = 0;
+ struct iov_iter saved_iter;
+ int ret;

if (WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)))
return -EIO;
@@@ -1329,11 -1366,10 +1367,11 @@@
if (bio->bi_bdev && blk_queue_pci_p2pdma(bio->bi_bdev->bd_disk->queue))
flags |= ITER_ALLOW_P2PDMA;

+ saved_iter = *iter;
do {
- ssize_t ret;
+ ssize_t size;

- ret = iov_iter_extract_bvecs(iter, bio->bi_io_vec,
+ size = iov_iter_extract_bvecs(iter, bio->bi_io_vec,
maxlen - bio->bi_iter.bi_size,
&bio->bi_vcnt, bio->bi_max_vecs,
mem_align_mask, flags);
@@@ -1358,7 -1386,27 +1388,28 @@@

if (is_pci_p2pdma_page(bio->bi_io_vec->bv_page))
bio->bi_opf |= REQ_NOMERGE;
- return bio_iov_iter_align_down(bio, iter, len_align_mask);
+ ret = bio_iov_iter_align_down(bio, iter, len_align_mask);
+ if (ret)
+ return ret;
+
+ /*
+ * 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))
+ goto out_release_pages;
+ return 0;
+
+ out_release_pages:
+ /*
+ * Release the pages pinned so far before failing, since this bio won't
+ * be submitted to release them.
+ */
+ bio_release_pages(bio, false);
+ bio_clear_flag(bio, BIO_PAGE_PINNED);
+ bio->bi_vcnt = 0;
++ *iter = saved_iter;
+ return -EINVAL;
}

static struct folio *folio_alloc_greedy(gfp_t gfp, size_t *size,

Attachment: signature.asc
Description: PGP signature