Re: [PATCH] nvme-pci: add missing condition check for existence of mapped data

From: Keith Busch
Date: Tue Jul 30 2024 - 13:12:29 EST


On Wed, Jul 24, 2024 at 01:31:14PM +0300, Leon Romanovsky wrote:
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 102a9fb0c65f..cdc0b25091e9 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -863,7 +863,8 @@ static blk_status_t nvme_prep_rq(struct nvme_dev *dev, struct request *req)
> nvme_start_request(req);
> return BLK_STS_OK;
> out_unmap_data:
> - nvme_unmap_data(dev, req);
> + if (blk_rq_nr_phys_segments(req))
> + nvme_unmap_data(dev, req);

This is already applied, but it is kind of strange. We get here only if
metadata mapping fails. Is there actually a command that has metadata
without data?