bdev_nvme: set to deactive state when deleting NS bdev

Since the number of NVMe controller's Namespace is a const
variable, so the Namespace block device is a static array,
and is assigned with NSID after initialization, so when
users want to delete a specified block device, we can
just change it into inactive state.

Fix issue #495.

Change-Id: Ie6e33ad59f2375cc2b5099624bfe1ef6918a6264
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/433543
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Changpeng Liu 2018-11-15 22:04:17 -05:00 committed by Jim Harris
parent 2706cd4238
commit 3126157a21

View File

@ -282,7 +282,7 @@ bdev_nvme_destruct(void *ctx)
pthread_mutex_lock(&g_bdev_nvme_mutex);
nvme_ctrlr->ref--;
free(nvme_disk->disk.name);
memset(nvme_disk, 0, sizeof(*nvme_disk));
nvme_disk->active = false;
if (nvme_ctrlr->ref == 0 && nvme_ctrlr->destruct) {
/* Clear destruct sign in case of reentering controller destruct */
nvme_ctrlr->destruct = false;