diff --git a/include/spdk/nvme.h b/include/spdk/nvme.h index 20f4b7d0b..3b15c01da 100644 --- a/include/spdk/nvme.h +++ b/include/spdk/nvme.h @@ -218,6 +218,12 @@ typedef void (*spdk_nvme_attach_cb)(void *cb_ctx, const struct spdk_nvme_probe_i * Callback for spdk_nvme_probe() to report that a device attached to the userspace NVMe driver * has been removed from the system. * + * The controller will remain in a failed state (any new I/O submitted will fail). + * + * The controller must be detached from the userspace driver by calling spdk_nvme_detach() + * once the controller is no longer in use. It is up to the library user to ensure that + * no other threads are using the controller before calling spdk_nvme_detach(). + * * \param ctrlr NVMe controller instance that was removed. */ typedef void (*spdk_nvme_remove_cb)(void *cb_ctx, struct spdk_nvme_ctrlr *ctrlr); diff --git a/lib/nvme/nvme.c b/lib/nvme/nvme.c index df3f53e52..51123e264 100644 --- a/lib/nvme/nvme.c +++ b/lib/nvme/nvme.c @@ -489,7 +489,6 @@ static int nvme_hotplug_monitor(void *cb_ctx, spdk_nvme_probe_cb probe_cb, spdk_nvme_attach_cb attach_cb, spdk_nvme_remove_cb remove_cb) { - int rc = 0; struct spdk_nvme_ctrlr *ctrlr; struct spdk_uevent event; @@ -522,14 +521,6 @@ nvme_hotplug_monitor(void *cb_ctx, spdk_nvme_probe_cb probe_cb, spdk_nvme_attach if (remove_cb) { remove_cb(cb_ctx, ctrlr); } - if (spdk_process_is_primary()) { - rc = spdk_nvme_detach(ctrlr); - if (rc) { - SPDK_ERRLOG("Failed to hot detach nvme address: %04x:%04x:%04x.%u\n", - event.pci_addr.domain, event.pci_addr.bus, event.pci_addr.dev, - event.pci_addr.func); - } - } } } }