nvmf/vfio-user: unregister the memory region whether controller is active or not
The controller may be freed eailer than endpoint, so we still need to unregister the memory region from SPDK. The case can happen when removing the listener while VM is connected. Change-Id: I95d49cefdbff3e0bdea316fac824ef8b218fcd2c Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10378 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot
This commit is contained in:
parent
69dc63da50
commit
c2fa2d50e1
@ -1617,9 +1617,7 @@ memory_region_remove_cb(vfu_ctx_t *vfu_ctx, vfu_dma_info_t *info)
|
||||
}
|
||||
|
||||
assert(endpoint != NULL);
|
||||
if (endpoint->ctrlr == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (endpoint->ctrlr != NULL) {
|
||||
ctrlr = endpoint->ctrlr;
|
||||
|
||||
SPDK_DEBUGLOG(nvmf_vfio, "%s: unmap IOVA %#lx-%#lx\n", ctrlr_id(ctrlr),
|
||||
@ -1642,6 +1640,7 @@ memory_region_remove_cb(vfu_ctx_t *vfu_ctx, vfu_dma_info_t *info)
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&endpoint->lock);
|
||||
}
|
||||
|
||||
if (info->prot == (PROT_WRITE | PROT_READ)) {
|
||||
ret = spdk_mem_unregister(info->mapping.iov_base, info->mapping.iov_len);
|
||||
|
Loading…
Reference in New Issue
Block a user