bdev/nvme: exit controller removal callback if the destruction was started
For real PCIe drives, if we removed one drive, existing hotplug monitor will trigger the remove callback twice, there is one workaround for vfio-attached device hot remove detection which will also trigger the hot removal callback. For now we add the check in the bdev_nvme layer so that coredump will not happen. Fix issue #606. Change-Id: I0605fbdf391fed20c4aa9a2d54b4f059f29dc483 Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.gerrithub.io/c/445642 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>
This commit is contained in:
parent
1e5b58a1a0
commit
de3eb36a61
@ -1099,6 +1099,11 @@ remove_cb(void *cb_ctx, struct spdk_nvme_ctrlr *ctrlr)
|
||||
pthread_mutex_lock(&g_bdev_nvme_mutex);
|
||||
TAILQ_FOREACH(nvme_ctrlr, &g_nvme_ctrlrs, tailq) {
|
||||
if (nvme_ctrlr->ctrlr == ctrlr) {
|
||||
/* The controller's destruction was already started */
|
||||
if (nvme_ctrlr->destruct) {
|
||||
pthread_mutex_unlock(&g_bdev_nvme_mutex);
|
||||
return;
|
||||
}
|
||||
pthread_mutex_unlock(&g_bdev_nvme_mutex);
|
||||
for (i = 0; i < nvme_ctrlr->num_ns; i++) {
|
||||
uint32_t nsid = i + 1;
|
||||
@ -1111,7 +1116,6 @@ remove_cb(void *cb_ctx, struct spdk_nvme_ctrlr *ctrlr)
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&g_bdev_nvme_mutex);
|
||||
assert(!nvme_ctrlr->destruct);
|
||||
nvme_ctrlr->destruct = true;
|
||||
if (nvme_ctrlr->ref == 0) {
|
||||
pthread_mutex_unlock(&g_bdev_nvme_mutex);
|
||||
|
Loading…
Reference in New Issue
Block a user