Commit fc96810c authored by Ed Reed's avatar Ed Reed Committed by Konrad Sztyber
Browse files

bdev: remove bdev from examine allow list on unregister



Removes the Bdev from the examine allow list on unregister to enable
re-registration of a Bdev with the same name.

Change-Id: Iefcb5ff8addd7859df56f1f2a3ce3cc309fde528
Signed-off-by: default avatarEd Reed <edreed@microsoft.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/25426


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Community-CI: Community CI Samsung <spdk.community.ci.samsung@gmail.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarJim Harris <jim.harris@nvidia.com>
parent a0c12854
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -657,6 +657,20 @@ bdev_examine_allowlist_check(const char *name)
	return false;
}

static inline void
bdev_examine_allowlist_remove(const char *name)
{
	struct spdk_bdev_examine_item *item;
	TAILQ_FOREACH(item, &g_bdev_examine_allowlist, link) {
		if (strcmp(name, item->name) == 0) {
			TAILQ_REMOVE(&g_bdev_examine_allowlist, item, link);
			free(item->name);
			free(item);
			break;
		}
	}
}

static inline void
bdev_examine_allowlist_free(void)
{
@@ -7949,6 +7963,7 @@ static int
bdev_unregister_unsafe(struct spdk_bdev *bdev)
{
	struct spdk_bdev_desc	*desc, *tmp;
	struct spdk_bdev_alias	*alias;
	int			rc = 0;
	char			uuid[SPDK_UUID_STRING_LEN];

@@ -7969,6 +7984,10 @@ bdev_unregister_unsafe(struct spdk_bdev *bdev)

	/* If there are no descriptors, proceed removing the bdev */
	if (rc == 0) {
		bdev_examine_allowlist_remove(bdev->name);
		TAILQ_FOREACH(alias, &bdev->aliases, tailq) {
			bdev_examine_allowlist_remove(alias->alias.name);
		}
		TAILQ_REMOVE(&g_bdev_mgr.bdevs, bdev, internal.link);
		SPDK_DEBUGLOG(bdev, "Removing bdev %s from list done\n", bdev->name);