Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sagig@dev.mellanox.co.il (Sagi Grimberg)
Subject: [PATCH 1/3] nvme: add missing unmaps in nvme_queue_rq
Date: Sat, 10 Oct 2015 02:46:51 +0300	[thread overview]
Message-ID: <561851EB.1070503@dev.mellanox.co.il> (raw)
In-Reply-To: <1444409756-7317-2-git-send-email-hch@lst.de>

On 10/9/2015 7:55 PM, Christoph Hellwig wrote:
> When we fail various metadata related operations in nvme_queue_rq we
> need to unmap the data SGL.
>
> Cc: stable at vger.kernel.org
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
>   drivers/nvme/host/pci.c | 15 ++++++++++++---
>   1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index a526696..0a85fab 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -904,19 +904,28 @@ static int nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
>   			goto retry_cmd;
>   		}
>   		if (blk_integrity_rq(req)) {
> -			if (blk_rq_count_integrity_sg(req->q, req->bio) != 1)
> +			if (blk_rq_count_integrity_sg(req->q, req->bio) != 1) {
> +				dma_unmap_sg(dev->dev, iod->sg, iod->nents,
> +						dma_dir);
>   				goto error_cmd;
> +			}
>
>   			sg_init_table(iod->meta_sg, 1);
>   			if (blk_rq_map_integrity_sg(
> -					req->q, req->bio, iod->meta_sg) != 1)
> +					req->q, req->bio, iod->meta_sg) != 1) {
> +				dma_unmap_sg(dev->dev, iod->sg, iod->nents,
> +						dma_dir);
>   				goto error_cmd;
> +			}
>
>   			if (rq_data_dir(req))
>   				nvme_dif_remap(req, nvme_dif_prep);
>
> -			if (!dma_map_sg(nvmeq->q_dmadev, iod->meta_sg, 1, dma_dir))
> +			if (!dma_map_sg(nvmeq->q_dmadev, iod->meta_sg, 1, dma_dir)) {
> +				dma_unmap_sg(dev->dev, iod->sg, iod->nents,
> +						dma_dir);
>   				goto error_cmd;
> +			}
>   		}
>   	}
>
>

Hi Christoph,

Would it be better to unmap the data sg once at error_cmd tag?

  reply	other threads:[~2015-10-09 23:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-09 16:55 nvme ->queue_rq updates Christoph Hellwig
2015-10-09 16:55 ` [PATCH 1/3] nvme: add missing unmaps in nvme_queue_rq Christoph Hellwig
2015-10-09 23:46   ` Sagi Grimberg [this message]
2015-10-10  6:55     ` Christoph Hellwig
2015-10-09 16:55 ` [PATCH 2/3] nvme: simplify nvme_setup_prps calling convention Christoph Hellwig
2015-10-09 16:55 ` [PATCH 3/3] nvme: refactor nvme_queue_rq Christoph Hellwig
2015-10-09 20:11   ` Jon Derrick
2015-10-10  6:53     ` Christoph Hellwig
2015-10-10  7:28     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=561851EB.1070503@dev.mellanox.co.il \
    --to=sagig@dev.mellanox.co.il \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox