bdev/nvme: Deleting OPAL and OCSSD after completing unregistration of io_device
Deleting OPAL device and OCSSD ctrlr after completing unregistration of io_device will be safer and be helpful for the upcoming patches to introduce subsystem. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I7eb11d5c19bf50903496a7fb936c77aa05089046 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6889 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
68a8502f1c
commit
1a0144b7c4
@ -119,6 +119,15 @@ nvme_bdev_unregister_cb(void *io_device)
|
||||
struct nvme_bdev_ctrlr_trid *trid, *tmp_trid;
|
||||
uint32_t i;
|
||||
|
||||
if (nvme_bdev_ctrlr->opal_dev) {
|
||||
spdk_opal_dev_destruct(nvme_bdev_ctrlr->opal_dev);
|
||||
nvme_bdev_ctrlr->opal_dev = NULL;
|
||||
}
|
||||
|
||||
if (nvme_bdev_ctrlr->ocssd_ctrlr) {
|
||||
bdev_ocssd_fini_ctrlr(nvme_bdev_ctrlr);
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&g_bdev_nvme_mutex);
|
||||
TAILQ_REMOVE(&g_nvme_bdev_ctrlrs, nvme_bdev_ctrlr, tailq);
|
||||
pthread_mutex_unlock(&g_bdev_nvme_mutex);
|
||||
@ -155,15 +164,6 @@ nvme_bdev_ctrlr_do_destruct(void *ctx)
|
||||
{
|
||||
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr = ctx;
|
||||
|
||||
if (nvme_bdev_ctrlr->opal_dev) {
|
||||
spdk_opal_dev_destruct(nvme_bdev_ctrlr->opal_dev);
|
||||
nvme_bdev_ctrlr->opal_dev = NULL;
|
||||
}
|
||||
|
||||
if (nvme_bdev_ctrlr->ocssd_ctrlr) {
|
||||
bdev_ocssd_fini_ctrlr(nvme_bdev_ctrlr);
|
||||
}
|
||||
|
||||
spdk_io_device_unregister(nvme_bdev_ctrlr, nvme_bdev_unregister_cb);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user