From: Max Gurtovoy <maxg@mellanox.com>
To: linux-block@vger.kernel.org, axboe@kernel.dk,
martin.petersen@oracle.com, linux-nvme@lists.infradead.org,
keith.busch@intel.com, hch@lst.de, sagi@grimberg.me
Cc: Max Gurtovoy <maxg@mellanox.com>,
shlomin@mellanox.com, israelr@mellanox.com
Subject: [PATCH 2/4] nvme-rdma: simplify error flow in nvme_rdma_queue_rq
Date: Tue, 3 Sep 2019 18:14:13 +0300 [thread overview]
Message-ID: <1567523655-23989-2-git-send-email-maxg@mellanox.com> (raw)
In-Reply-To: <1567523655-23989-1-git-send-email-maxg@mellanox.com>
Make the error flow symmetric to the good flow by moving the call to
nvme_cleanup_cmd from nvme_rdma_unmap_data function.
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
---
drivers/nvme/host/rdma.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 1a6449b..db4a60f 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -1149,7 +1149,6 @@ static void nvme_rdma_unmap_data(struct nvme_rdma_queue *queue,
req->nents, rq_data_dir(rq) ==
WRITE ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
- nvme_cleanup_cmd(rq);
sg_free_table_chained(&req->sg_table, SG_CHUNK_SIZE);
}
@@ -1748,7 +1747,6 @@ static blk_status_t nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx,
if (unlikely(err < 0)) {
dev_err(queue->ctrl->ctrl.device,
"Failed to map data (%d)\n", err);
- nvme_cleanup_cmd(rq);
goto err;
}
@@ -1759,18 +1757,19 @@ static blk_status_t nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx,
err = nvme_rdma_post_send(queue, sqe, req->sge, req->num_sge,
req->mr ? &req->reg_wr.wr : NULL);
- if (unlikely(err)) {
- nvme_rdma_unmap_data(queue, rq);
- goto err;
- }
+ if (unlikely(err))
+ goto err_unmap;
return BLK_STS_OK;
+err_unmap:
+ nvme_rdma_unmap_data(queue, rq);
err:
if (err == -ENOMEM || err == -EAGAIN)
ret = BLK_STS_RESOURCE;
else
ret = BLK_STS_IOERR;
+ nvme_cleanup_cmd(rq);
unmap_qe:
ib_dma_unmap_single(dev, req->sqe.dma, sizeof(struct nvme_command),
DMA_TO_DEVICE);
@@ -1791,6 +1790,7 @@ static void nvme_rdma_complete_rq(struct request *rq)
struct ib_device *ibdev = queue->device->dev;
nvme_rdma_unmap_data(queue, rq);
+ nvme_cleanup_cmd(rq);
ib_dma_unmap_single(ibdev, req->sqe.dma, sizeof(struct nvme_command),
DMA_TO_DEVICE);
nvme_complete_rq(rq);
--
1.8.3.1
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2019-09-03 15:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-03 15:14 [PATCH 1/4] block: centrelize PI remapping logic to the block layer Max Gurtovoy
2019-09-03 15:14 ` Max Gurtovoy [this message]
2019-09-04 5:51 ` [PATCH 2/4] nvme-rdma: simplify error flow in nvme_rdma_queue_rq Christoph Hellwig
2019-09-03 15:14 ` [PATCH 3/4] nvme-tcp: introduce nvme_tcp_complete_rq callback Max Gurtovoy
2019-09-03 19:15 ` Sagi Grimberg
2019-09-04 5:54 ` Christoph Hellwig
2019-09-04 9:02 ` Max Gurtovoy
2019-09-03 15:14 ` [PATCH 4/4] nvmet-loop: fix possible leakage during error flow Max Gurtovoy
2019-09-04 5:50 ` Christoph Hellwig
2019-09-03 19:11 ` [PATCH 1/4] block: centrelize PI remapping logic to the block layer Sagi Grimberg
2019-09-03 19:21 ` Jens Axboe
2019-09-04 5:49 ` Christoph Hellwig
2019-09-04 8:32 ` Max Gurtovoy
2019-09-04 12:49 ` 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=1567523655-23989-2-git-send-email-maxg@mellanox.com \
--to=maxg@mellanox.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=israelr@mellanox.com \
--cc=keith.busch@intel.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=martin.petersen@oracle.com \
--cc=sagi@grimberg.me \
--cc=shlomin@mellanox.com \
/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;
as well as URLs for NNTP newsgroup(s).