[PATCH v2] nvme-multipath: set BIO_REMAPPED on bios remapped to per-path namespace disks

Hannes Reinecke hare at suse.de
Mon Jun 1 00:06:04 PDT 2026


On 5/30/26 16:34, Achkinazi, Igor wrote:
> Hannes Reinecke wrote:
>> ... or you could introduce __bio_set_dev():
>>
>> diff --git a/include/linux/bio.h b/include/linux/bio.h
>> index 97d747320b35..5a2709adeea7 100644
>> --- a/include/linux/bio.h
>> +++ b/include/linux/bio.h
>> @@ -518,15 +518,20 @@ static inline void blkcg_punt_bio_submit(struct
>> bio *bio)
>>    }
>>    #endif /* CONFIG_BLK_CGROUP */
>>
>> -static inline void bio_set_dev(struct bio *bio, struct block_device *bdev)
>> +static inline void __bio_set_dev(struct bio *bio, struct block_device
>> *bdev)
>>    {
>> -       bio_clear_flag(bio, BIO_REMAPPED);
>>           if (bio->bi_bdev != bdev)
>>                   bio_clear_flag(bio, BIO_BPS_THROTTLED);
>>           bio->bi_bdev = bdev;
>>           bio_associate_blkg(bio);
>>    }
>>
>> +static inline void bio_set_dev(struct bio *bio, struct block_device *bdev)
>> +{
>> +       bio_clear_flag(bio, BIO_REMAPPED);
>> +       __bio_set_dev(bio, bdev);
>> +}
>> +
>>    /*
>>     * BIO list management for use by remapping drivers (e.g. DM or MD)
>> and loop.
>>     *
>>
>> to avoid all this clear-and-set-flag dance.
> 
> 
> Thanks Hannes. It is a cleaner approach and avoids the clear-and-set
> dance. However it touches the block layer (bio.h) and would need
> wider review and testing across all bio_set_dev callers.
> 
> I'd prefer to keep this patch as a minimal, nvme multipath fix that
> Is easy to backport to stable kernels where this race is hitting us
> today. The __bio_set_dev() approach (or Keith's patch that is
> removing set_capacity(0) entirely) could follow as the proper
> long-term solution.
> 
Errm. So you are saying: the real solution is too cumbersome,
let someone else do it?

I'll happily give you my reviewed by for the proper solution, and help
you to move the real solution forward.
But pushing the can down the road ... no.

Cheers

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare at suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich



More information about the Linux-nvme mailing list