Commit 1a0144b7 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Jim Harris
Browse files

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: default avatarShuhei 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent 68a8502f
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -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);
}