nvme: free IO qpair when cleaning up died process
Change-Id: I136945b6bed4d2cdb0ee54b27b224c2e9cec377f Signed-off-by: GangCao <gang.cao@intel.com>
This commit is contained in:
parent
48820a5ef6
commit
52f3c2fa52
@ -933,13 +933,15 @@ nvme_ctrlr_remove_process(struct spdk_nvme_ctrlr *ctrlr,
|
||||
|
||||
/**
|
||||
* This function will be called when the process exited unexpectedly
|
||||
* in order to free any incomplete nvme request and allocated memory.
|
||||
* in order to free any incomplete nvme request, allocated IO qpairs
|
||||
* and allocated memory.
|
||||
* Note: the ctrlr_lock must be held when calling this function.
|
||||
*/
|
||||
static void
|
||||
nvme_ctrlr_cleanup_process(struct spdk_nvme_ctrlr_process *proc)
|
||||
{
|
||||
struct nvme_request *req, *tmp_req;
|
||||
struct spdk_nvme_qpair *qpair, *tmp_qpair;
|
||||
|
||||
STAILQ_FOREACH_SAFE(req, &proc->active_reqs, stailq, tmp_req) {
|
||||
STAILQ_REMOVE(&proc->active_reqs, req, nvme_request, stailq);
|
||||
@ -949,6 +951,12 @@ nvme_ctrlr_cleanup_process(struct spdk_nvme_ctrlr_process *proc)
|
||||
nvme_free_request(req);
|
||||
}
|
||||
|
||||
TAILQ_FOREACH_SAFE(qpair, &proc->allocated_io_qpairs, per_process_tailq, tmp_qpair) {
|
||||
TAILQ_REMOVE(&proc->allocated_io_qpairs, qpair, per_process_tailq);
|
||||
|
||||
spdk_nvme_ctrlr_free_io_qpair(qpair);
|
||||
}
|
||||
|
||||
spdk_free(proc);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user