From 457afd77b16cd3c56fca04feb0db2c060cad20a8 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Fri, 5 Jul 2019 14:54:27 +0900 Subject: [PATCH] bdev/split: Fix orphan'ed config when removing the base bdev first When we create a base bdev and then create a split vbdev on top of the base bdev, if we delete the base bdev first, we have no way to remove the configuration of the split vbdev. Hence even if we create a base bdev again, we cannot create any split vbdev on top of the base bdev again. The meaning of flag, `removed` of `struct spdk_vbdev_split_config` is not clear and there will be no issue even if the flag `removed`. Hence remove the flag `removed` in this patch. Signed-off-by: Shuhei Matsumoto Change-Id: I053c95e647721004cecfe4fd8b0f1ff5bb9bf38a Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460580 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Changpeng Liu --- lib/bdev/split/vbdev_split.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/bdev/split/vbdev_split.c b/lib/bdev/split/vbdev_split.c index 2cf5f5882..1f187a122 100644 --- a/lib/bdev/split/vbdev_split.c +++ b/lib/bdev/split/vbdev_split.c @@ -55,7 +55,6 @@ struct spdk_vbdev_split_config { SPDK_BDEV_PART_TAILQ splits; struct spdk_bdev_part_base *split_base; - bool removed; TAILQ_ENTRY(spdk_vbdev_split_config) tailq; }; @@ -102,10 +101,7 @@ vbdev_split_base_free(void *ctx) { struct spdk_vbdev_split_config *cfg = ctx; - cfg->split_base = NULL; - if (cfg->removed) { - vbdev_split_del_config(cfg); - } + vbdev_split_del_config(cfg); } static int @@ -294,7 +290,6 @@ vbdev_split_create(struct spdk_vbdev_split_config *cfg) return 0; err: split_base_tailq = spdk_bdev_part_base_get_tailq(cfg->split_base); - cfg->removed = true; spdk_bdev_part_base_hotremove(cfg->split_base, split_base_tailq); return rc; } @@ -312,7 +307,6 @@ vbdev_split_destruct_config(struct spdk_vbdev_split_config *cfg) { struct bdev_part_tailq *split_base_tailq; - cfg->removed = true; if (cfg->split_base != NULL) { split_base_tailq = spdk_bdev_part_base_get_tailq(cfg->split_base); spdk_bdev_part_base_hotremove(cfg->split_base, split_base_tailq); @@ -468,7 +462,7 @@ vbdev_split_examine(struct spdk_bdev *bdev) { struct spdk_vbdev_split_config *cfg = vbdev_split_config_find_by_base_name(bdev->name); - if (cfg != NULL && cfg->removed == false) { + if (cfg != NULL) { assert(cfg->split_base == NULL); if (vbdev_split_create(cfg)) {