diff --git a/src/mgmt/srv_target.c b/src/mgmt/srv_target.c index 4098a3225ad..c8307df90ec 100644 --- a/src/mgmt/srv_target.c +++ b/src/mgmt/srv_target.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2016-2022 Intel Corporation. + * (C) Copyright 2016-2024 Intel Corporation. * * SPDX-License-Identifier: BSD-2-Clause-Patent */ @@ -171,12 +171,17 @@ struct tgt_destroy_args { int tda_rc; }; +struct tgt_kill_arg { + uuid_t pool_uuid; + unsigned int flags; +}; + static inline int -tgt_kill_pool(void *args) +tgt_kill_pool(void *data) { - struct d_uuid *id = args; + struct tgt_kill_arg *arg = data; - return vos_pool_kill(id->uuid, 0); + return vos_pool_kill(arg->pool_uuid, arg->flags); } /** @@ -267,18 +272,22 @@ struct dead_pool { static int clear_vos_pool(uuid_t uuid) { - int rc; - struct d_uuid id; + struct tgt_kill_arg kill_arg; + int rc; /* destroy blobIDs */ D_DEBUG(DB_MGMT, "Clear SPDK blobs for pool "DF_UUID"\n", DP_UUID(uuid)); - rc = vos_pool_kill(uuid, VOS_POF_RDB); + uuid_copy(kill_arg.pool_uuid, uuid); + kill_arg.flags = VOS_POF_RDB; + /* This maybe called from main thread, so let's execute the kill on system xtream */ + rc = dss_ult_execute(tgt_kill_pool, &kill_arg, NULL, NULL, DSS_XS_SYS, 0, 0); if (rc != 0) { D_ERROR(DF_UUID": kill pool service VOS pool: "DF_RC"\n", DP_UUID(uuid), DP_RC(rc)); return rc; } - uuid_copy(id.uuid, uuid); - rc = dss_thread_collective(tgt_kill_pool, &id, 0); + + kill_arg.flags = 0; + rc = dss_thread_collective(tgt_kill_pool, &kill_arg, 0); if (rc != 0) { D_ERROR("tgt_kill_pool, rc: "DF_RC"\n", DP_RC(rc)); return rc; @@ -464,7 +473,6 @@ recreate_pooltgts() int rc = 0; int pool_list_cnt; daos_size_t rdb_blob_sz = 0; - struct d_uuid id; D_ASSERT(bio_nvme_configured(SMD_DEV_TYPE_META)); D_INIT_LIST_HEAD(&pool_list); @@ -478,10 +486,13 @@ recreate_pooltgts() /* Cleanup Newborns */ if ((pool_info->spi_blob_sz[SMD_DEV_TYPE_META] == 0) || (pool_info->spi_flags[SMD_DEV_TYPE_META] & SMD_POOL_IN_CREATION)) { + struct tgt_kill_arg arg; + D_INFO("cleaning up newborn pool "DF_UUID"\n", DP_UUID(pool_info->spi_id)); - uuid_copy(id.uuid, pool_info->spi_id); - rc = dss_thread_collective(tgt_kill_pool, &id, 0); + uuid_copy(arg.pool_uuid, pool_info->spi_id); + arg.flags = 0; + rc = dss_thread_collective(tgt_kill_pool, &arg, 0); if (rc) { D_ERROR("failed to cleanup newborn pool "DF_UUID": "DF_RC"\n", DP_UUID(pool_info->spi_id), DP_RC(rc)); @@ -1216,15 +1227,18 @@ static int tgt_destroy(uuid_t pool_uuid, char *path) { struct tgt_destroy_args tda = {0}; + struct tgt_kill_arg arg; pthread_t thread; int rc; /* destroy blobIDs first */ - uuid_copy(tda.tda_id.uuid, pool_uuid); - rc = dss_thread_collective(tgt_kill_pool, &tda.tda_id, 0); + uuid_copy(arg.pool_uuid, pool_uuid); + arg.flags = 0; + rc = dss_thread_collective(tgt_kill_pool, &arg, 0); if (rc && rc != -DER_BUSY) goto out; + uuid_copy(tda.tda_id.uuid, pool_uuid); tda.tda_path = path; tda.tda_rc = rc; tda.tda_dx = dss_current_xstream();