bdev/raid: do not set configuring raid bdev to offline

Previously, the difference between configuring and offline is
unclear, this patch just fixes it. The key difference should be
whether the raid bdev have ever registered. Offline is registered
before but unregistered now, and configuring has never registered.

According to the above, we should never set configuring raid bdev to
offline because it never got registered.

Change-Id: Id44ef6654e032993ffb8444e7e7ae3e43a9b0f16
Signed-off-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/428321
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
wuzhouhui 2018-10-08 12:04:34 +08:00 committed by Jim Harris
parent 2c1aaa7604
commit 5349f4b2d4
2 changed files with 8 additions and 15 deletions

View File

@ -1360,8 +1360,7 @@ raid_bdev_configure(struct raid_bdev *raid_bdev)
* have same blocklen * have same blocklen
*/ */
SPDK_ERRLOG("Blocklen of various bdevs not matching\n"); SPDK_ERRLOG("Blocklen of various bdevs not matching\n");
rc = -EINVAL; return -EINVAL;
goto offline;
} }
} }
@ -1403,13 +1402,10 @@ raid_bdev_configure(struct raid_bdev *raid_bdev)
raid_bdev->bdev.name); raid_bdev->bdev.name);
rc = spdk_bdev_register(raid_bdev_gen); rc = spdk_bdev_register(raid_bdev_gen);
if (rc != 0) { if (rc != 0) {
/* SPDK_ERRLOG("Unable to register pooled bdev and stay at configuring state\n");
* If failed to register raid bdev to bdev layer, make raid bdev offline
* and add to offline list
*/
SPDK_ERRLOG("Unable to register pooled bdev\n");
spdk_io_device_unregister(raid_bdev, NULL); spdk_io_device_unregister(raid_bdev, NULL);
goto offline; raid_bdev->state = RAID_BDEV_STATE_CONFIGURING;
return rc;
} }
SPDK_DEBUGLOG(SPDK_LOG_BDEV_RAID, "raid bdev generic %p\n", raid_bdev_gen); SPDK_DEBUGLOG(SPDK_LOG_BDEV_RAID, "raid bdev generic %p\n", raid_bdev_gen);
TAILQ_REMOVE(&g_spdk_raid_bdev_configuring_list, raid_bdev, state_link); TAILQ_REMOVE(&g_spdk_raid_bdev_configuring_list, raid_bdev, state_link);
@ -1419,12 +1415,6 @@ raid_bdev_configure(struct raid_bdev *raid_bdev)
} }
return 0; return 0;
offline:
raid_bdev->state = RAID_BDEV_STATE_OFFLINE;
TAILQ_REMOVE(&g_spdk_raid_bdev_configuring_list, raid_bdev, state_link);
TAILQ_INSERT_TAIL(&g_spdk_raid_bdev_offline_list, raid_bdev, state_link);
return rc;
} }
/* /*

View File

@ -44,7 +44,10 @@ enum raid_bdev_state {
/* raid bdev is ready and is seen by upper layers */ /* raid bdev is ready and is seen by upper layers */
RAID_BDEV_STATE_ONLINE, RAID_BDEV_STATE_ONLINE,
/* raid bdev is configuring, not all underlying bdevs are present */ /*
* raid bdev is configuring, not all underlying bdevs are present.
* And can't be seen by upper layers.
*/
RAID_BDEV_STATE_CONFIGURING, RAID_BDEV_STATE_CONFIGURING,
/* /*