Skip to content

Commit 8a24f84

Browse files
authored
DAOS-18296 rdb: Call vos_pool_create/open in ULTs (#17302)
Call vos_pool_create and vos_pool_open in new deep-stack ULTs on the xstream to avoid pmemobj_create and pmemobj_open from potentially overflowing caller stacks. Signed-off-by: Li Wei <liwei@hpe.com>
1 parent 80040ac commit 8a24f84

File tree

3 files changed

+95
-12
lines changed

3 files changed

+95
-12
lines changed

src/engine/ult.c

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* (C) Copyright 2016-2024 Intel Corporation.
3-
* (C) Copyright 2025 Hewlett Packard Enterprise Development LP
3+
* (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP
44
*
55
* SPDX-License-Identifier: BSD-2-Clause-Patent
66
*/
@@ -9,6 +9,7 @@
99

1010
#include <abt.h>
1111
#include <daos/common.h>
12+
#include <daos_srv/vos.h>
1213
#include <daos_errno.h>
1314
#include "srv_internal.h"
1415

@@ -931,3 +932,80 @@ dss_chore_queue_fini(struct dss_xstream *dx)
931932
ABT_cond_free(&queue->chq_cond);
932933
ABT_mutex_free(&queue->chq_mutex);
933934
}
935+
936+
struct dss_vos_pool_create_args {
937+
const char *spc_path;
938+
unsigned char *spc_uuid;
939+
daos_size_t spc_scm_size;
940+
daos_size_t spc_data_sz;
941+
daos_size_t spc_meta_sz;
942+
unsigned int spc_flags;
943+
uint32_t spc_version;
944+
daos_handle_t *spc_pool;
945+
};
946+
947+
static int
948+
dss_vos_pool_create_ult(void *varg)
949+
{
950+
struct dss_vos_pool_create_args *arg = varg;
951+
952+
return vos_pool_create(arg->spc_path, arg->spc_uuid, arg->spc_scm_size, arg->spc_data_sz,
953+
arg->spc_meta_sz, arg->spc_flags, arg->spc_version, arg->spc_pool);
954+
}
955+
956+
/**
957+
* Call vos_pool_create in a new deep-stack ULT on the same xstream. This is to
958+
* avoid pmemobj_create or SPDK from overflowing the stack of the calling ULT.
959+
*/
960+
int
961+
dss_vos_pool_create(const char *path, unsigned char *uuid, daos_size_t scm_size,
962+
daos_size_t data_sz, daos_size_t meta_sz, unsigned int flags, uint32_t version,
963+
daos_handle_t *pool)
964+
{
965+
struct dss_vos_pool_create_args args;
966+
967+
args.spc_path = path;
968+
args.spc_uuid = uuid;
969+
args.spc_scm_size = scm_size;
970+
args.spc_data_sz = data_sz;
971+
args.spc_meta_sz = meta_sz;
972+
args.spc_flags = flags;
973+
args.spc_version = version;
974+
args.spc_pool = pool;
975+
976+
return dss_ult_execute(dss_vos_pool_create_ult, &args, NULL /* user_cb */,
977+
NULL /* cb_args */, DSS_XS_SELF, 0 /* tgt_id */, DSS_DEEP_STACK_SZ);
978+
}
979+
980+
struct dss_vos_pool_open_args {
981+
const char *spo_path;
982+
unsigned char *spo_uuid;
983+
unsigned int spo_flags;
984+
daos_handle_t *spo_pool;
985+
};
986+
987+
static int
988+
dss_vos_pool_open_ult(void *varg)
989+
{
990+
struct dss_vos_pool_open_args *arg = varg;
991+
992+
return vos_pool_open(arg->spo_path, arg->spo_uuid, arg->spo_flags, arg->spo_pool);
993+
}
994+
995+
/**
996+
* Call vos_pool_open in a new deep-stack ULT on the same xstream. This is to
997+
* avoid pmemobj_open or SPDK from overflowing the stack of the calling ULT.
998+
*/
999+
int
1000+
dss_vos_pool_open(const char *path, unsigned char *uuid, unsigned int flags, daos_handle_t *pool)
1001+
{
1002+
struct dss_vos_pool_open_args args;
1003+
1004+
args.spo_path = path;
1005+
args.spo_uuid = uuid;
1006+
args.spo_flags = flags;
1007+
args.spo_pool = pool;
1008+
1009+
return dss_ult_execute(dss_vos_pool_open_ult, &args, NULL /* user_cb */, NULL /* cb_args */,
1010+
DSS_XS_SELF, 0 /* tgt_id */, DSS_DEEP_STACK_SZ);
1011+
}

src/include/daos_srv/daos_engine.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* (C) Copyright 2016-2024 Intel Corporation.
3-
* (C) Copyright 2025 Hewlett Packard Enterprise Development LP
3+
* (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP
44
*
55
* SPDX-License-Identifier: BSD-2-Clause-Patent
66
*/
@@ -846,4 +846,11 @@ dss_select_module_version(int module_id, uint8_t *module_ver)
846846
return dss_select_module_version(module_id, version); \
847847
}
848848

849+
int
850+
dss_vos_pool_create(const char *path, unsigned char *uuid, daos_size_t scm_size,
851+
daos_size_t data_sz, daos_size_t meta_sz, unsigned int flags, uint32_t version,
852+
daos_handle_t *pool);
853+
int
854+
dss_vos_pool_open(const char *path, unsigned char *uuid, unsigned int flags, daos_handle_t *pool);
855+
849856
#endif /* __DSS_API_H__ */

src/rdb/rdb.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* (C) Copyright 2017-2023 Intel Corporation.
3-
* (C) Copyright 2025 Hewlett Packard Enterprise Development LP
3+
* (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP
44
*
55
* SPDX-License-Identifier: BSD-2-Clause-Patent
66
*/
@@ -57,13 +57,12 @@ rdb_create(const char *path, const uuid_t uuid, uint64_t caller_term,
5757
* basic system memory reservation and VOS_POF_EXCL for concurrent
5858
* access protection.
5959
*/
60-
rc = vos_pool_create(path, (unsigned char *)uuid, params->rcp_size, 0 /* data_sz */,
61-
0 /* meta_sz */,
62-
VOS_POF_SMALL | VOS_POF_EXCL | VOS_POF_RDB | VOS_POF_EXTERNAL_CHKPT,
63-
params->rcp_vos_df_version, &pool);
60+
rc = dss_vos_pool_create(
61+
path, (unsigned char *)uuid, params->rcp_size, 0 /* data_sz */, 0 /* meta_sz */,
62+
VOS_POF_SMALL | VOS_POF_EXCL | VOS_POF_RDB | VOS_POF_EXTERNAL_CHKPT,
63+
params->rcp_vos_df_version, &pool);
6464
if (rc != 0)
6565
goto out;
66-
ABT_thread_yield();
6766

6867
/* Create and open the metadata container. */
6968
rc = vos_cont_create(pool, (unsigned char *)uuid);
@@ -427,9 +426,9 @@ rdb_open(const char *path, const uuid_t uuid, uint64_t caller_term, struct rdb_c
427426
* RDB pools specify VOS_POF_SMALL for basic system memory reservation
428427
* and VOS_POF_EXCL for concurrent access protection.
429428
*/
430-
rc = vos_pool_open(path, (unsigned char *)uuid,
431-
VOS_POF_SMALL | VOS_POF_EXCL | VOS_POF_RDB | VOS_POF_EXTERNAL_CHKPT,
432-
&pool);
429+
rc = dss_vos_pool_open(path, (unsigned char *)uuid,
430+
VOS_POF_SMALL | VOS_POF_EXCL | VOS_POF_RDB | VOS_POF_EXTERNAL_CHKPT,
431+
&pool);
433432
if (rc == -DER_ID_MISMATCH) {
434433
ds_notify_ras_eventf(RAS_RDB_DF_INCOMPAT, RAS_TYPE_INFO, RAS_SEV_ERROR,
435434
NULL /* hwid */, NULL /* rank */, NULL /* inc */,
@@ -442,7 +441,6 @@ rdb_open(const char *path, const uuid_t uuid, uint64_t caller_term, struct rdb_c
442441
path, DP_RC(rc));
443442
goto err;
444443
}
445-
ABT_thread_yield();
446444

447445
rc = vos_cont_open(pool, (unsigned char *)uuid, &mc);
448446
if (rc != 0) {

0 commit comments

Comments
 (0)