Unsupported P2P transfers used to fail with BLK_STS_TARGET, chosen by commit 91fb2b6052f7 ("nvme-pci: convert to using dma_map_sgtable()") for dma_map_sgtable()'s -EREMOTEIO: an I/O that can never succeed on this device must not be retried. The blk_rq_dma_map conversion changed it to BLK_STS_INVAL, which blk_path_error() treats as retryable and md deliberately ignores for member failures -- a P2P write to a member the peer cannot reach is counted as written and the mirrors silently diverge. Restore BLK_STS_TARGET. Hit e.g. with CMB memory of one NVMe device used as the data buffer for I/O to a second one behind a different host bridge. Fixes: 858299dc6160 ("block: add scatterlist-less DMA mapping helpers") Fixes: 7ce3c1dd78fc ("nvme-pci: convert the data mapping to blk_rq_dma_map") Cc: stable@vger.kernel.org # v6.17 Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Mykola Marzhan Reviewed-by: Logan Gunthorpe --- block/blk-mq-dma.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block/blk-mq-dma.c b/block/blk-mq-dma.c index bfdb9ed70741..c17e4c49900c 100644 --- a/block/blk-mq-dma.c +++ b/block/blk-mq-dma.c @@ -190,7 +190,11 @@ static bool blk_dma_map_iter_start(struct request *req, struct device *dma_dev, case PCI_P2PDMA_MAP_NONE: break; default: - iter->status = BLK_STS_INVAL; + /* + * Match dma_map_sgtable()'s -EREMOTEIO: this transfer + * can never succeed, so don't let it be retried. + */ + iter->status = BLK_STS_TARGET; return false; } -- 2.52.0