libnvme: Unset ctrlr on teardown.

This way we do not attempt to tear down more than once,
which triggers an assert in mutex destruction.
This commit is contained in:
Augustin Cavalier
2020-04-23 01:02:17 -04:00
parent 9a3a70f437
commit 9f703d301c
@@ -961,6 +961,9 @@ fail:
void nvme_qpair_destroy(struct nvme_qpair *qpair)
{
if (!qpair->ctrlr)
return; // Not initialized.
if (nvme_qpair_is_admin_queue(qpair))
_nvme_qpair_admin_qpair_destroy(qpair);
@@ -978,6 +981,8 @@ void nvme_qpair_destroy(struct nvme_qpair *qpair)
}
nvme_request_pool_destroy(qpair);
qpair->ctrlr = NULL;
pthread_mutex_destroy(&qpair->lock);
}