On Tue, Jul 07, 2026 at 03:44:54PM -0400, Mike Snitzer wrote:
> On Mon, Jul 06, 2026 at 02:52:33PM -0600, Keith Busch wrote:
> > On Wed, Jun 24, 2026 at 01:14:03PM +0200, Mikulas Patocka wrote:
> > > This approach is OK, I will stage the patches when 7.2-rc1 comes out and
> > > when I'll fork the dm git branches.
> > >
> > > I suggest one change - it is kind of hacky when multiple I/O completion
> > > callbacks write into io->orig_bio->bi_status concurrently - so it would
> > > be
> > > better to not do it and maintain and return separate bit mask for
> > > non-retryable errors.
> > >
> > > For example:
> > >
> > > static void complete_io(struct io *io)
> > > {
> > > unsigned long error_bits = io->error_bits;
> > > unsigned long nonretryable_error_bits =
> > > io->nonretryable_error_bits;
> > > io_notify_fn fn = io->callback;
> > > void *context = io->context;
> > >
> > > if (io->vma_invalidate_size)
> > > invalidate_kernel_vmap_range(io->vma_invalidate_address,
> > > io->vma_invalidate_size);
> > >
> > > mempool_free(io, &io->client->pool);
> > > fn(error_bits, nonretryable_error_bits, context);
> > > }
> > >
> > > static void dec_count(struct io *io, unsigned int region, blk_status_t
> > > error)
> > > {
> > > if (unlikely(error == BLK_STS_NOTSUPP) || unlikely(error ==
> > > BLK_STS_INVAL))
> > > set_bit(region, &io->nonretryable_error_bits);
> > > else if (unlikely(error != BLK_STS_OK))
> > > set_bit(region, &io->error_bits);
> > >
> > > if (atomic_dec_and_test(&io->count))
> > > complete_io(io);
> > > }
> > >
> > > Please send the updated patch that uses this approach.
> >
> > Sure thing, I can get started on that. Though I think it's largely
> > obviated if we get the block layer to handle things early rather than
> > submit malformed bio's, and this will accomplish that:
> >
> > https://lore.kernel.org/dm-devel/[email protected]/
>
> Jens hasn't picked that series up yet. Jens?
>
> > But I can certainly respin this series as it provides a more indepth
> > defence.
> >
> > I also owe an update on the relaxed dm-crypt direct-io memory alignment
> > as well, as that series fell through the cracks on me for the previous
> > merge window.
>
> So where does dm-raid1 and dm-crypt stand relative to these DIO memory
> alignment changes? Inferring they are pretty exposed.
>
> > > BTW. I think that blk_path_error should also test for BLK_STS_INVAL and
> > > return false, otherwise, dm-multipath would be suffering from this bug
> > > too. Ben, could you test it?
> >
> > Good point.
>
> Would appreciate knowing if multipath exposed too.
I can't make it happen. I can reproduce this using dm-mirror, but when I
try with dm-multipath, it fails with BLK_STS_INVAL before it ever makes
it into the request layer.
blk_mq_submit_bio() -> __bio_split_to_limits() -> bio_split_rw() ->
bio_split_rw_at() -> bio_split_io_at()
bio_split_io_at() checks the bio_vec alignment and fails with -EINVAL,
causing the bio to get failed.
-Ben
>
> Thanks,
> Mike