bdev/raid: Consolidate spdk_io_device_unregister() calls in destruction paths

This is a preparation to add completion callback to the
destroy_raid_bdev RPC.

spdk_io_device_unregister should be called after spdk_bdev_unregister
because IO channel should be terminated after all open descriptors
are closed. This patch follows the practices of other bdev modules.

Change-Id: I6003edf0a6f6b2b235bf66f4b81bb0c2b855ae14
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450570
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-04-09 09:25:54 +09:00 committed by Jim Harris
parent 9d30b0d346
commit 8c969cf018

View File

@ -242,9 +242,10 @@ raid_bdev_destruct(void *ctxt)
TAILQ_REMOVE(&g_raid_bdev_configured_list, raid_bdev, state_link);
raid_bdev->state = RAID_BDEV_STATE_OFFLINE;
TAILQ_INSERT_TAIL(&g_raid_bdev_offline_list, raid_bdev, state_link);
spdk_io_device_unregister(raid_bdev, NULL);
}
spdk_io_device_unregister(raid_bdev, NULL);
if (raid_bdev->num_base_bdevs_discovered == 0) {
/* Free raid_bdev when there are no base bdevs left */
SPDK_DEBUGLOG(SPDK_LOG_BDEV_RAID, "raid bdev base bdevs is 0, going to free all in destruct\n");
@ -1732,7 +1733,6 @@ raid_bdev_deconfigure(struct raid_bdev *raid_bdev)
TAILQ_INSERT_TAIL(&g_raid_bdev_offline_list, raid_bdev, state_link);
SPDK_DEBUGLOG(SPDK_LOG_BDEV_RAID, "raid bdev state chaning from online to offline\n");
spdk_io_device_unregister(raid_bdev, NULL);
spdk_bdev_unregister(&raid_bdev->bdev, NULL, NULL);
}