nvme: free req_buf after deleting queues

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I941a4cb5563cebb2e68b48d3a74b4b73af0e9657
Reviewed-on: https://review.gerrithub.io/365662
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Jim Harris 2017-06-15 07:05:56 -07:00 committed by Daniel Verkamp
parent 9f770dae7e
commit 302828bb5b

View File

@ -205,6 +205,7 @@ int
spdk_nvme_ctrlr_free_io_qpair(struct spdk_nvme_qpair *qpair) spdk_nvme_ctrlr_free_io_qpair(struct spdk_nvme_qpair *qpair)
{ {
struct spdk_nvme_ctrlr *ctrlr; struct spdk_nvme_ctrlr *ctrlr;
void *req_buf;
if (qpair == NULL) { if (qpair == NULL) {
return 0; return 0;
@ -230,13 +231,15 @@ spdk_nvme_ctrlr_free_io_qpair(struct spdk_nvme_qpair *qpair)
TAILQ_REMOVE(&ctrlr->active_io_qpairs, qpair, tailq); TAILQ_REMOVE(&ctrlr->active_io_qpairs, qpair, tailq);
spdk_bit_array_set(ctrlr->free_io_qids, qpair->id); spdk_bit_array_set(ctrlr->free_io_qids, qpair->id);
spdk_dma_free(qpair->req_buf); req_buf = qpair->req_buf;
if (nvme_transport_ctrlr_delete_io_qpair(ctrlr, qpair)) { if (nvme_transport_ctrlr_delete_io_qpair(ctrlr, qpair)) {
nvme_robust_mutex_unlock(&ctrlr->ctrlr_lock); nvme_robust_mutex_unlock(&ctrlr->ctrlr_lock);
return -1; return -1;
} }
spdk_dma_free(req_buf);
nvme_robust_mutex_unlock(&ctrlr->ctrlr_lock); nvme_robust_mutex_unlock(&ctrlr->ctrlr_lock);
return 0; return 0;
} }