From: "Steve Wise" <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
To: 'Sagi Grimberg' <sagi-ImC7XgPzLAfvYQKSrp0J2Q@public.gmane.org>,
'Christoph Hellwig' <hch-jcswGhMUV9g@public.gmane.org>,
axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org,
keith.busch-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Cc: linux-nvme-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
'Armen Baloyan'
<armenx.baloyan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
'Jay Freyensee'
<james.p.freyensee-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
'Ming Lin' <ming.l-Vzezgt5dB6uUEJcrhfAQsw@public.gmane.org>,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: RE: [PATCH 4/5] nvmet-rdma: add a NVMe over Fabrics RDMA target driver
Date: Thu, 9 Jun 2016 16:42:11 -0500 [thread overview]
Message-ID: <051801d1c297$c7d8a7d0$5789f770$@opengridcomputing.com> (raw)
In-Reply-To: <5756B75C.9000409-ImC7XgPzLAfvYQKSrp0J2Q@public.gmane.org>
<snip>
> > +
> > +static struct nvmet_rdma_queue *
> > +nvmet_rdma_alloc_queue(struct nvmet_rdma_device *ndev,
> > + struct rdma_cm_id *cm_id,
> > + struct rdma_cm_event *event)
> > +{
> > + struct nvmet_rdma_queue *queue;
> > + int ret;
> > +
> > + queue = kzalloc(sizeof(*queue), GFP_KERNEL);
> > + if (!queue) {
> > + ret = NVME_RDMA_CM_NO_RSC;
> > + goto out_reject;
> > + }
> > +
> > + ret = nvmet_sq_init(&queue->nvme_sq);
> > + if (ret)
> > + goto out_free_queue;
> > +
> > + ret = nvmet_rdma_parse_cm_connect_req(&event->param.conn,
> queue);
> > + if (ret)
> > + goto out_destroy_sq;
> > +
> > + /*
> > + * Schedules the actual release because calling rdma_destroy_id from
> > + * inside a CM callback would trigger a deadlock. (great API
design..)
> > + */
> > + INIT_WORK(&queue->release_work,
> nvmet_rdma_release_queue_work);
> > + queue->dev = ndev;
> > + queue->cm_id = cm_id;
> > +
> > + spin_lock_init(&queue->state_lock);
> > + queue->state = NVMET_RDMA_Q_CONNECTING;
> > + INIT_LIST_HEAD(&queue->rsp_wait_list);
> > + INIT_LIST_HEAD(&queue->rsp_wr_wait_list);
> > + spin_lock_init(&queue->rsp_wr_wait_lock);
> > + INIT_LIST_HEAD(&queue->free_rsps);
> > + spin_lock_init(&queue->rsps_lock);
> > +
> > + queue->idx = ida_simple_get(&nvmet_rdma_queue_ida, 0, 0,
> GFP_KERNEL);
> > + if (queue->idx < 0) {
> > + ret = NVME_RDMA_CM_NO_RSC;
> > + goto out_free_queue;
> > + }
> > +
> > + ret = nvmet_rdma_alloc_rsps(queue);
> > + if (ret) {
> > + ret = NVME_RDMA_CM_NO_RSC;
> > + goto out_ida_remove;
> > + }
> > +
> > + if (!ndev->srq) {
> > + queue->cmds = nvmet_rdma_alloc_cmds(ndev,
> > + queue->recv_queue_size,
> > + !queue->host_qid);
> > + if (IS_ERR(queue->cmds)) {
> > + ret = NVME_RDMA_CM_NO_RSC;
> > + goto out_free_cmds;
> > + }
> > + }
> > +
Should the above error path actually goto a block that frees the rsps? Like
this?
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index c184ee5..8aaa36f 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -1053,7 +1053,7 @@ nvmet_rdma_alloc_queue(struct nvmet_rdma_device *ndev,
!queue->host_qid);
if (IS_ERR(queue->cmds)) {
ret = NVME_RDMA_CM_NO_RSC;
- goto out_free_cmds;
+ goto out_free_responses;
}
}
@@ -1073,6 +1073,8 @@ out_free_cmds:
queue->recv_queue_size,
!queue->host_qid);
}
+out_free_responses:
+ nvmet_rdma_free_rsps(queue);
out_ida_remove:
ida_simple_remove(&nvmet_rdma_queue_ida, queue->idx);
out_destroy_sq:
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-06-09 21:42 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1465248215-18186-1-git-send-email-hch@lst.de>
2016-06-07 11:57 ` NVMe over Fabrics RDMA transport drivers Sagi Grimberg
[not found] ` <5756B695.5020305-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2016-06-07 12:01 ` Christoph Hellwig
2016-06-07 14:55 ` Woodruff, Robert J
2016-06-07 20:14 ` Steve Wise
2016-06-07 20:27 ` Christoph Hellwig
[not found] ` <1465248215-18186-4-git-send-email-hch@lst.de>
[not found] ` <1465248215-18186-4-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-06-07 11:59 ` [PATCH 3/5] nvme-rdma.h: Add includes for nvme rdma_cm negotiation Sagi Grimberg
[not found] ` <1465248215-18186-5-git-send-email-hch@lst.de>
2016-06-07 12:00 ` [PATCH 4/5] nvmet-rdma: add a NVMe over Fabrics RDMA target driver Sagi Grimberg
[not found] ` <5756B75C.9000409-ImC7XgPzLAfvYQKSrp0J2Q@public.gmane.org>
2016-06-09 21:42 ` Steve Wise [this message]
2016-06-09 21:54 ` Ming Lin
2016-06-14 14:32 ` Christoph Hellwig
2016-06-09 23:03 ` Steve Wise
2016-06-14 14:31 ` Christoph Hellwig
2016-06-14 15:14 ` Steve Wise
[not found] ` <00ea01d1c64f$64db8880$2e929980$@opengridcomputing.com>
2016-06-14 15:23 ` Steve Wise
2016-06-14 16:10 ` Steve Wise
2016-06-14 16:22 ` Steve Wise
2016-06-15 18:32 ` Sagi Grimberg
2016-06-14 16:47 ` Hefty, Sean
[not found] ` <1465248215-18186-6-git-send-email-hch@lst.de>
[not found] ` <1465248215-18186-6-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-06-07 12:00 ` [PATCH 5/5] nvme-rdma: add a NVMe over Fabrics RDMA host driver Sagi Grimberg
2016-07-06 12:55 NVMe over Fabrics RDMA transport drivers V2 Christoph Hellwig
[not found] ` <1467809752-31320-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-07-06 12:55 ` [PATCH 4/5] nvmet-rdma: add a NVMe over Fabrics RDMA target driver Christoph Hellwig
[not found] ` <1467809752-31320-5-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-07-08 13:51 ` Steve Wise
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='051801d1c297$c7d8a7d0$5789f770$@opengridcomputing.com' \
--to=swise-7bpotxp6k4+p2yhjcf5u+vpxobypeauw@public.gmane.org \
--cc=armenx.baloyan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org \
--cc=hch-jcswGhMUV9g@public.gmane.org \
--cc=james.p.freyensee-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=keith.busch-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-nvme-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=ming.l-Vzezgt5dB6uUEJcrhfAQsw@public.gmane.org \
--cc=sagi-ImC7XgPzLAfvYQKSrp0J2Q@public.gmane.org \
/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).