All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] nvmet: release the sq ref on rdma read errors
@ 2017-05-08 23:38 Vijay Immanuel
  2017-05-10 17:12 ` Christoph Hellwig
  2017-05-11 10:53 ` Christoph Hellwig
  0 siblings, 2 replies; 4+ messages in thread
From: Vijay Immanuel @ 2017-05-08 23:38 UTC (permalink / raw)


On rdma read errors, release the sq ref that was taken
when the req was initialized. This avoids a hang in
nvmet_sq_destroy() when the queue is being freed.

Signed-off-by: Vijay Immanuel <vijayi at attalasystems.com>
---
Changes in v2:
  - Added nvmet_req_uninit().
  - Release the rsp without queuing it.

 drivers/nvme/target/core.c  | 6 ++++++
 drivers/nvme/target/nvmet.h | 1 +
 drivers/nvme/target/rdma.c  | 1 +
 3 files changed, 8 insertions(+)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 798653b..fcb2906 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -529,6 +529,12 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,
 }
 EXPORT_SYMBOL_GPL(nvmet_req_init);
 
+void nvmet_req_uninit(struct nvmet_req *req)
+{
+	percpu_ref_put(&req->sq->ref);
+}
+EXPORT_SYMBOL_GPL(nvmet_req_uninit);
+
 static inline bool nvmet_cc_en(u32 cc)
 {
 	return cc & 0x1;
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index f7ff15f..dae9ed6 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -261,6 +261,7 @@ struct nvmet_async_event {
 
 bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,
 		struct nvmet_sq *sq, struct nvmet_fabrics_ops *ops);
+void nvmet_req_uninit(struct nvmet_req *req);
 void nvmet_req_complete(struct nvmet_req *req, u16 status);
 
 void nvmet_cq_setup(struct nvmet_ctrl *ctrl, struct nvmet_cq *cq, u16 qid,
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index ecc4fe8..8fc245d 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -567,6 +567,7 @@ static void nvmet_rdma_read_data_done(struct ib_cq *cq, struct ib_wc *wc)
 	rsp->n_rdma = 0;
 
 	if (unlikely(wc->status != IB_WC_SUCCESS)) {
+		nvmet_req_uninit(&rsp->req);
 		nvmet_rdma_release_rsp(rsp);
 		if (wc->status != IB_WC_WR_FLUSH_ERR) {
 			pr_info("RDMA READ for CQE 0x%p failed with status %s (%d).\n",
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2] nvmet: release the sq ref on rdma read errors
  2017-05-08 23:38 [PATCH v2] nvmet: release the sq ref on rdma read errors Vijay Immanuel
@ 2017-05-10 17:12 ` Christoph Hellwig
  2017-05-11 10:50   ` Sagi Grimberg
  2017-05-11 10:53 ` Christoph Hellwig
  1 sibling, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2017-05-10 17:12 UTC (permalink / raw)


Looks good to me:

Reviewed-by: Christoph Hellwig <hch at lst.de>

Sagi: are you fine with this as well?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] nvmet: release the sq ref on rdma read errors
  2017-05-10 17:12 ` Christoph Hellwig
@ 2017-05-11 10:50   ` Sagi Grimberg
  0 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2017-05-11 10:50 UTC (permalink / raw)


> Looks good to me:
>
> Reviewed-by: Christoph Hellwig <hch at lst.de>
>
> Sagi: are you fine with this as well?

I am,

Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] nvmet: release the sq ref on rdma read errors
  2017-05-08 23:38 [PATCH v2] nvmet: release the sq ref on rdma read errors Vijay Immanuel
  2017-05-10 17:12 ` Christoph Hellwig
@ 2017-05-11 10:53 ` Christoph Hellwig
  1 sibling, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2017-05-11 10:53 UTC (permalink / raw)


Thanks,

applied to nvme-4.12.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-05-11 10:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-08 23:38 [PATCH v2] nvmet: release the sq ref on rdma read errors Vijay Immanuel
2017-05-10 17:12 ` Christoph Hellwig
2017-05-11 10:50   ` Sagi Grimberg
2017-05-11 10:53 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.