nvme: do not detach automatically on hot remove
The user's remove_cb should detach the NVMe controller when it can ensure that it is no longer in use. In the interim (between remove_cb and spdk_nvme_detach()), the controller will remain in a failed state, so any new I/O submissions will return an error code but not crash. examples/nvme/hotplug is not yet updated for this change, but that will be done in a separate patch. Change-Id: I8827ba36f9688ccb734e7871f20f11ec11e88f96 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
10690dedcd
commit
13827a74a8
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user