bdev/raid: raid_bdev_remove_base_bdev: cleanup not registered raid bdev

If raid bdev creation failed, the bdev still be configuring and not
register it. For those raid bdev, raid_bdev_remove_base_bdev() should
cleanup them as well.

Change-Id: If2eda8ec80e7fdeb5e551fafe57a43a27ae0f9e6
Signed-off-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/427331
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
wuzhouhui 2018-09-30 11:35:42 +08:00 committed by Jim Harris
parent 5349f4b2d4
commit e8b0ae0393

View File

@ -1488,8 +1488,13 @@ raid_bdev_remove_base_bdev(void *ctx)
assert(raid_bdev->base_bdev_info[i].desc);
raid_bdev->base_bdev_info[i].remove_scheduled = true;
if (raid_bdev->destruct_called == true && raid_bdev->base_bdev_info[i].bdev != NULL) {
/* As raid bdev is already unregistered, so cleanup should be done here itself */
if ((raid_bdev->destruct_called == true ||
raid_bdev->state == RAID_BDEV_STATE_CONFIGURING) &&
raid_bdev->base_bdev_info[i].bdev != NULL) {
/*
* As raid bdev is not registered yet or already unregistered, so cleanup
* should be done here itself
*/
raid_bdev_free_base_bdev_resource(raid_bdev, i);
if (raid_bdev->num_base_bdevs_discovered == 0) {
/* Since there is no base bdev for this raid, so free the raid device */