[PATCH v4 7/9] md/raid1,raid10: skip futile retries on P2PDMA mapping failures

Logan Gunthorpe logang at deltatee.com
Wed Jul 22 12:18:27 PDT 2026



On 2026-07-22 12:58, Mykola Marzhan wrote:
> From: Logan Gunthorpe <logang at deltatee.com>
> 
> BLK_STS_P2PDMA reflects the peer/member pairing, not member health:
> retrying the same pages on the same member cannot succeed.  Keep
> WriteErrorSeen so the range stays fenced, but skip WantReplacement and
> FailFast eviction, as commit f7b24c7b41f2 ("md/raid1,raid10: don't fail
> devices for invalid IO errors") did for BLK_STS_INVAL.
> 
> The failure is whole-range and deterministic, so narrow_write_error()'s
> block-by-block submit_bio_wait() retries are pointless.  Record the
> whole range as a bad block in the completion handler instead.
> 
> Fixes: 02666132403a ("md: propagate BLK_FEAT_PCI_P2PDMA from member devices to RAID device")
> Assisted-by: Claude:claude-fable-5
> Signed-off-by: Logan Gunthorpe <logang at deltatee.com>
> Co-developed-by: Mykola Marzhan <mykola at meshstor.io>
> Signed-off-by: Mykola Marzhan <mykola at meshstor.io>
> ---
>  drivers/md/raid1-10.c |  3 +++
>  drivers/md/raid1.c    | 12 +++++++++---
>  drivers/md/raid10.c   |  8 +++++++-
>  3 files changed, 19 insertions(+), 4 deletions(-)

Maybe drop my authorship from this patch. I only did the first hunk and
don't fully understand the bulk of it.


> diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c
> index cee21452e066..89daf8558251 100644
> --- a/drivers/md/raid1-10.c
> +++ b/drivers/md/raid1-10.c
> @@ -309,6 +309,9 @@ static inline void raid1_write_error(struct mddev *mddev, struct md_rdev *rdev,
>  {
>  	set_bit(WriteErrorSeen, &rdev->flags);
>  
> +	if (bio->bi_status == BLK_STS_P2PDMA)
> +		return;
> +
>  	if (!test_and_set_bit(WantReplacement, &rdev->flags))
>  		set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
>  
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index 19c4dec450de..917d694ef401 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -2624,10 +2624,16 @@ static void handle_write_finished(struct r1conf *conf, struct r1bio *r1_bio)
>  			 * narrow down and record precise write
>  			 * errors.
>  			 */
> +			struct md_rdev *rdev = conf->mirrors[m].rdev;
> +
>  			fail = true;
> -			narrow_write_error(r1_bio, m);
> -			rdev_dec_pending(conf->mirrors[m].rdev,
> -					 conf->mddev);
> +			/* Mapping failures are whole-range and deterministic */

I'm not sure I follow the point of this new comment here.


Thanks,

Logan




More information about the Linux-nvme mailing list