bdev/raid: Process only the first call of destroy_raid_bdev RPC

We have to process only the first call of destroy_raid_bdev RPC
for the same RAID bdev.

The existing flag destruct_called cannot be used for that purpose
because of the following reason.

destruct_called is set to true in both of
- destroy_raid_bdev RPC
- hot removal of any base bdev.
If destruct_called is set in destroy_raid_bdev RPC, destroy_raid_bdev
RPC must return immediately, but if destruct_called is set in hot
removal of any base bdev, destroy_raid_bdev RPC must go forward
with the current logic.

Hence add another flag destroy_started to struct raid_bdev and
use it.

Change-Id: Ifeefcaa1d289499342d8bb9bc162ded65e0368dd
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450885
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-04-11 11:56:30 +09:00 committed by Darek Stojaczyk
parent 010ec3af0c
commit 0d9a2b504a
2 changed files with 14 additions and 0 deletions

View File

@ -1848,6 +1848,17 @@ raid_bdev_remove_base_devices(struct raid_bdev_config *raid_cfg,
return;
}
if (raid_bdev->destroy_started) {
SPDK_DEBUGLOG(SPDK_LOG_BDEV_RAID, "destroying raid bdev %s is already started\n",
raid_cfg->name);
if (cb_fn) {
cb_fn(cb_arg, -EALREADY);
}
return;
}
raid_bdev->destroy_started = true;
for (i = 0; i < raid_bdev->num_base_bdevs; i++) {
info = &raid_bdev->base_bdev_info[i];

View File

@ -127,6 +127,9 @@ struct raid_bdev {
/* Set to true if destruct is called for this raid bdev */
bool destruct_called;
/* Set to true if destroy of this raid bdev is started. */
bool destroy_started;
};
/*