diff --git a/src/engine/ult.c b/src/engine/ult.c index 69bcddb7e32..1456573e1dd 100644 --- a/src/engine/ult.c +++ b/src/engine/ult.c @@ -1,6 +1,6 @@ /** * (C) Copyright 2016-2024 Intel Corporation. - * (C) Copyright 2025 Hewlett Packard Enterprise Development LP + * (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP * * SPDX-License-Identifier: BSD-2-Clause-Patent */ @@ -9,6 +9,7 @@ #include #include +#include #include #include "srv_internal.h" @@ -945,3 +946,77 @@ dss_chore_queue_fini(struct dss_xstream *dx) ABT_cond_free(&queue->chq_cond); ABT_mutex_free(&queue->chq_mutex); } + +struct dss_vos_pool_create_args { + const char *spc_path; + unsigned char *spc_uuid; + daos_size_t spc_scm_size; + daos_size_t spc_blob_sz; + unsigned int spc_flags; + uint32_t spc_version; + daos_handle_t *spc_pool; +}; + +static int +dss_vos_pool_create_ult(void *varg) +{ + struct dss_vos_pool_create_args *arg = varg; + + return vos_pool_create(arg->spc_path, arg->spc_uuid, arg->spc_scm_size, arg->spc_blob_sz, + arg->spc_flags, arg->spc_version, arg->spc_pool); +} + +/** + * Call vos_pool_create in a new deep-stack ULT on the same xstream. This is to + * avoid pmemobj_create or SPDK from overflowing the stack of the calling ULT. + */ +int +dss_vos_pool_create(const char *path, unsigned char *uuid, daos_size_t scm_size, + daos_size_t blob_sz, unsigned int flags, uint32_t version, daos_handle_t *pool) +{ + struct dss_vos_pool_create_args args; + + args.spc_path = path; + args.spc_uuid = uuid; + args.spc_scm_size = scm_size; + args.spc_blob_sz = blob_sz; + args.spc_flags = flags; + args.spc_version = version; + args.spc_pool = pool; + + return dss_ult_execute(dss_vos_pool_create_ult, &args, NULL /* user_cb */, + NULL /* cb_args */, DSS_XS_SELF, 0 /* tgt_id */, DSS_DEEP_STACK_SZ); +} + +struct dss_vos_pool_open_args { + const char *spo_path; + unsigned char *spo_uuid; + unsigned int spo_flags; + daos_handle_t *spo_pool; +}; + +static int +dss_vos_pool_open_ult(void *varg) +{ + struct dss_vos_pool_open_args *arg = varg; + + return vos_pool_open(arg->spo_path, arg->spo_uuid, arg->spo_flags, arg->spo_pool); +} + +/** + * Call vos_pool_open in a new deep-stack ULT on the same xstream. This is to + * avoid pmemobj_open or SPDK from overflowing the stack of the calling ULT. + */ +int +dss_vos_pool_open(const char *path, unsigned char *uuid, unsigned int flags, daos_handle_t *pool) +{ + struct dss_vos_pool_open_args args; + + args.spo_path = path; + args.spo_uuid = uuid; + args.spo_flags = flags; + args.spo_pool = pool; + + return dss_ult_execute(dss_vos_pool_open_ult, &args, NULL /* user_cb */, NULL /* cb_args */, + DSS_XS_SELF, 0 /* tgt_id */, DSS_DEEP_STACK_SZ); +} diff --git a/src/include/daos_srv/daos_engine.h b/src/include/daos_srv/daos_engine.h index 8b5f19649a0..68c388cab1a 100644 --- a/src/include/daos_srv/daos_engine.h +++ b/src/include/daos_srv/daos_engine.h @@ -1,6 +1,6 @@ /** * (C) Copyright 2016-2024 Intel Corporation. - * (C) Copyright 2025 Hewlett Packard Enterprise Development LP + * (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP * * SPDX-License-Identifier: BSD-2-Clause-Patent */ @@ -801,4 +801,10 @@ dss_chore_diy(struct dss_chore *chore); bool engine_in_check(void); +int +dss_vos_pool_create(const char *path, unsigned char *uuid, daos_size_t scm_size, + daos_size_t blob_sz, unsigned int flags, uint32_t version, daos_handle_t *pool); +int +dss_vos_pool_open(const char *path, unsigned char *uuid, unsigned int flags, daos_handle_t *pool); + #endif /* __DSS_API_H__ */ diff --git a/src/rdb/rdb.c b/src/rdb/rdb.c index 7ca0879ed3a..2b608b05b1b 100644 --- a/src/rdb/rdb.c +++ b/src/rdb/rdb.c @@ -1,5 +1,6 @@ /** * (C) Copyright 2017-2023 Intel Corporation. + * (C) Copyright 2026 Hewlett Packard Enterprise Development LP * * SPDX-License-Identifier: BSD-2-Clause-Patent */ @@ -58,11 +59,10 @@ rdb_create(const char *path, const uuid_t uuid, uint64_t caller_term, size_t siz * basic system memory reservation and VOS_POF_EXCL for concurrent * access protection. */ - rc = vos_pool_create(path, (unsigned char *)uuid, size, 0 /* nvme_sz */, - VOS_POF_SMALL | VOS_POF_EXCL | VOS_POF_RDB, vos_df_version, &pool); + rc = dss_vos_pool_create(path, (unsigned char *)uuid, size, 0 /* nvme_sz */, + VOS_POF_SMALL | VOS_POF_EXCL | VOS_POF_RDB, vos_df_version, &pool); if (rc != 0) goto out; - ABT_thread_yield(); /* Create and open the metadata container. */ rc = vos_cont_create(pool, (unsigned char *)uuid); @@ -385,8 +385,8 @@ rdb_open(const char *path, const uuid_t uuid, uint64_t caller_term, struct rdb_c * RDB pools specify VOS_POF_SMALL for basic system memory reservation * and VOS_POF_EXCL for concurrent access protection. */ - rc = vos_pool_open(path, (unsigned char *)uuid, - VOS_POF_SMALL | VOS_POF_EXCL | VOS_POF_RDB, &pool); + rc = dss_vos_pool_open(path, (unsigned char *)uuid, + VOS_POF_SMALL | VOS_POF_EXCL | VOS_POF_RDB, &pool); if (rc == -DER_ID_MISMATCH) { ds_notify_ras_eventf(RAS_RDB_DF_INCOMPAT, RAS_TYPE_INFO, RAS_SEV_ERROR, NULL /* hwid */, NULL /* rank */, NULL /* inc */, @@ -399,7 +399,6 @@ rdb_open(const char *path, const uuid_t uuid, uint64_t caller_term, struct rdb_c path, DP_RC(rc)); goto err; } - ABT_thread_yield(); rc = vos_cont_open(pool, (unsigned char *)uuid, &mc); if (rc != 0) {