Commit 0d9a2b50 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Darek Stojaczyk
Browse files

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: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450885


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
parent 010ec3af
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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];

+3 −0
Original line number Diff line number Diff line
@@ -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;
};

/*