Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/chk/chk_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -2797,13 +2797,13 @@ chk_engine_cont_list_one(void *args)
int rc = 0;

ccla = streams[dss_get_module_info()->dmi_tgt_id].st_arg;
pool = ds_pool_child_lookup(ccla->ccla_pool);
DS_POOL_CHILD_LOOKUP(ccla->ccla_pool, &pool);
/* non-exist pool is not fatal. */
if (pool != NULL) {
param.ip_hdl = pool->spc_hdl;
rc = vos_iterate(&param, VOS_ITER_COUUID, false, &anchor,
chk_engine_cont_list_local_cb, NULL, ccla, NULL);
ds_pool_child_put(pool);
DS_POOL_CHILD_PUT(&pool);
}

return rc;
Expand Down
10 changes: 5 additions & 5 deletions src/container/container_iv.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* (C) Copyright 2019-2023 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
*/
Expand Down Expand Up @@ -1018,7 +1018,7 @@ cont_iv_capa_refresh_ult(void *data)

D_ASSERT(dss_get_module_info()->dmi_xs_id == 0);

rc = ds_pool_lookup(arg->pool_uuid, &pool);
rc = DS_POOL_LOOKUP(arg->pool_uuid, &pool);
if (rc)
D_GOTO(out, rc);

Expand All @@ -1040,7 +1040,7 @@ cont_iv_capa_refresh_ult(void *data)
uuid_copy(arg->cont_uuid, iv_entry.cont_uuid);
out:
if (pool != NULL)
ds_pool_put(pool);
DS_POOL_PUT(&pool);

ABT_eventual_set(arg->eventual, (void *)&rc, sizeof(rc));
}
Expand Down Expand Up @@ -1567,7 +1567,7 @@ cont_iv_prop_fetch_ult(void *data)

D_ASSERT(dss_get_module_info()->dmi_xs_id == 0);

rc = ds_pool_lookup(arg->pool_uuid, &pool);
rc = DS_POOL_LOOKUP(arg->pool_uuid, &pool);
if (rc)
D_GOTO(out, rc);

Expand Down Expand Up @@ -1599,7 +1599,7 @@ cont_iv_prop_fetch_ult(void *data)

out:
if (pool != NULL)
ds_pool_put(pool);
DS_POOL_PUT(&pool);
D_FREE(iv_entry);
if (prop_fetch != NULL)
daos_prop_free(prop_fetch);
Expand Down
4 changes: 2 additions & 2 deletions src/container/srv_container.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ ds_cont_svc_step_up(struct cont_svc *svc)
int rc;

D_ASSERT(svc->cs_pool == NULL);
rc = ds_pool_lookup(svc->cs_pool_uuid, &svc->cs_pool);
rc = DS_POOL_LOOKUP(svc->cs_pool_uuid, &svc->cs_pool);
if (rc != 0) {
D_ERROR(DF_UUID": pool lookup failed: "DF_RC"\n",
DP_UUID(svc->cs_pool_uuid), DP_RC(rc));
Expand All @@ -225,7 +225,7 @@ ds_cont_svc_step_down(struct cont_svc *svc)
{
cont_svc_ec_agg_leader_stop(svc);
D_ASSERT(svc->cs_pool != NULL);
ds_pool_put(svc->cs_pool);
DS_POOL_PUT(&svc->cs_pool);
svc->cs_pool = NULL;
}

Expand Down
32 changes: 16 additions & 16 deletions src/container/srv_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ cont_child_alloc_ref(void *co_uuid, unsigned int ksize, void *po_uuid,
goto out_rebuild_cond;
}

cont->sc_pool = ds_pool_child_lookup(po_uuid);
DS_POOL_CHILD_LOOKUP(po_uuid, &cont->sc_pool);
if (cont->sc_pool == NULL) {
rc = -DER_NO_HDL;
goto out_finish_cond;
Expand Down Expand Up @@ -666,7 +666,7 @@ cont_child_alloc_ref(void *co_uuid, unsigned int ksize, void *po_uuid,
return 0;

out_pool:
ds_pool_child_put(cont->sc_pool);
DS_POOL_CHILD_PUT(&cont->sc_pool);
out_finish_cond:
ABT_cond_free(&cont->sc_fini_cond);
out_rebuild_cond:
Expand Down Expand Up @@ -695,7 +695,7 @@ cont_child_free_ref(struct daos_llink *llink)
DP_CONT(cont->sc_pool->spc_uuid, cont->sc_uuid));

vos_cont_close(cont->sc_hdl);
ds_pool_child_put(cont->sc_pool);
DS_POOL_CHILD_PUT(&cont->sc_pool);
daos_csummer_destroy(&cont->sc_csummer);
D_FREE(cont->sc_snapshots);
ABT_cond_free(&cont->sc_dtx_resync_cond);
Expand Down Expand Up @@ -1248,7 +1248,7 @@ cont_child_destroy_one(void *vin)
struct ds_cont_child *cont;
int rc;

pool = ds_pool_child_lookup(in->tdi_pool_uuid);
DS_POOL_CHILD_LOOKUP(in->tdi_pool_uuid, &pool);
if (pool == NULL)
D_GOTO(out, rc = -DER_NO_HDL);

Expand Down Expand Up @@ -1319,7 +1319,7 @@ cont_child_destroy_one(void *vin)
}

out_pool:
ds_pool_child_put(pool);
DS_POOL_CHILD_PUT(&pool);
out:
return rc;
}
Expand All @@ -1344,7 +1344,7 @@ ds_cont_tgt_destroy(uuid_t pool_uuid, uuid_t cont_uuid)
struct cont_tgt_destroy_in in;
int rc;

rc = ds_pool_lookup(pool_uuid, &pool);
rc = DS_POOL_LOOKUP(pool_uuid, &pool);
if (rc != 0) {
D_DEBUG(DB_MD, DF_UUID" lookup pool failed: %d\n",
DP_UUID(pool_uuid), rc);
Expand All @@ -1355,7 +1355,7 @@ ds_cont_tgt_destroy(uuid_t pool_uuid, uuid_t cont_uuid)
uuid_copy(in.tdi_uuid, cont_uuid);

cont_iv_entry_delete(pool->sp_iv_ns, pool_uuid, cont_uuid);
ds_pool_put(pool);
DS_POOL_PUT(&pool);

rc = ds_pool_thread_collective(pool_uuid, PO_COMP_ST_NEW | PO_COMP_ST_DOWN |
PO_COMP_ST_DOWNOUT, cont_child_destroy_one, &in, 0);
Expand Down Expand Up @@ -1430,7 +1430,7 @@ cont_child_create_start(uuid_t pool_uuid, uuid_t cont_uuid, uint32_t pm_ver,
struct ds_pool_child *pool_child;
int rc;

pool_child = ds_pool_child_lookup(pool_uuid);
DS_POOL_CHILD_LOOKUP(pool_uuid, &pool_child);
if (pool_child == NULL) {
D_ERROR(DF_CONT" : failed to find pool child\n",
DP_CONT(pool_uuid, cont_uuid));
Expand All @@ -1443,7 +1443,7 @@ cont_child_create_start(uuid_t pool_uuid, uuid_t cont_uuid, uint32_t pm_ver,
D_ASSERT(*cont_out != NULL);
(*cont_out)->sc_status_pm_ver = pm_ver;
}
ds_pool_child_put(pool_child);
DS_POOL_CHILD_PUT(&pool_child);
return rc;
}

Expand All @@ -1465,7 +1465,7 @@ cont_child_create_start(uuid_t pool_uuid, uuid_t cont_uuid, uint32_t pm_ver,
}
}

ds_pool_child_put(pool_child);
DS_POOL_CHILD_PUT(&pool_child);
return rc == 0 ? 1 : rc;
}

Expand Down Expand Up @@ -1736,7 +1736,7 @@ ds_cont_tgt_open(uuid_t pool_uuid, uuid_t cont_hdl_uuid,
int rc;

/* Only for debugging purpose to compare srv_cont_hdl with cont_hdl_uuid */
rc = ds_pool_lookup(pool_uuid, &pool);
rc = DS_POOL_LOOKUP(pool_uuid, &pool);
if (rc != 0) {
D_DEBUG(DB_MD, DF_UUID" lookup pool failed: "DF_RC"\n",
DP_UUID(pool_uuid), DP_RC(rc));
Expand All @@ -1747,7 +1747,7 @@ ds_cont_tgt_open(uuid_t pool_uuid, uuid_t cont_hdl_uuid,
if (uuid_compare(pool->sp_srv_cont_hdl, cont_hdl_uuid) == 0 && sec_capas == 0)
D_WARN("srv hdl "DF_UUID" capas is "DF_X64"\n",
DP_UUID(cont_hdl_uuid), sec_capas);
ds_pool_put(pool);
DS_POOL_PUT(&pool);

uuid_copy(arg.pool_uuid, pool_uuid);
uuid_copy(arg.cont_hdl_uuid, cont_hdl_uuid);
Expand Down Expand Up @@ -1870,7 +1870,7 @@ cont_query_one(void *vin)
if (pool_hdl == NULL)
return -DER_NO_HDL;

pool_child = ds_pool_child_lookup(pool_hdl->sph_pool->sp_uuid);
DS_POOL_CHILD_LOOKUP(pool_hdl->sph_pool->sp_uuid, &pool_child);
if (pool_child == NULL)
D_GOTO(ds_pool_hdl, rc = -DER_NO_HDL);

Expand All @@ -1892,7 +1892,7 @@ cont_query_one(void *vin)
out:
vos_cont_close(vos_chdl);
ds_child:
ds_pool_child_put(pool_child);
DS_POOL_CHILD_PUT(&pool_child);
ds_pool_hdl:
ds_pool_hdl_put(pool_hdl);
return rc;
Expand Down Expand Up @@ -2080,15 +2080,15 @@ cont_snapshots_refresh_ult(void *data)
struct ds_pool *pool;
int rc;

rc = ds_pool_lookup(args->pool_uuid, &pool);
rc = DS_POOL_LOOKUP(args->pool_uuid, &pool);
if (rc != 0) {
D_DEBUG(DB_MD, DF_UUID" lookup pool failed: "DF_RC"\n",
DP_UUID(args->pool_uuid), DP_RC(rc));
rc = -DER_NO_HDL;
goto out;
}
rc = cont_iv_snapshots_refresh(pool->sp_iv_ns, args->cont_uuid);
ds_pool_put(pool);
DS_POOL_PUT(&pool);
out:
if (rc != 0)
D_DEBUG(DB_TRACE, DF_UUID": failed to refresh snapshots IV: "
Expand Down
10 changes: 5 additions & 5 deletions src/dtx/dtx_resync.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* (C) Copyright 2019-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
*/
Expand Down Expand Up @@ -769,7 +769,7 @@ dtx_resync_one(void *data)
struct dtx_container_scan_arg cb_arg = { 0 };
int rc;

child = ds_pool_child_lookup(arg->pool_uuid);
DS_POOL_CHILD_LOOKUP(arg->pool_uuid, &child);
if (child == NULL)
D_GOTO(out, rc = -DER_NONEXIST);

Expand All @@ -794,7 +794,7 @@ dtx_resync_one(void *data)
D_FREE(param);
D_FREE(anchor);
if (child != NULL)
ds_pool_child_put(child);
DS_POOL_CHILD_PUT(&child);

D_DEBUG(DB_TRACE, DF_UUID" iterate pool done: rc %d\n",
DP_UUID(arg->pool_uuid), rc);
Expand All @@ -809,7 +809,7 @@ dtx_resync_ult(void *data)
struct ds_pool *pool = NULL;
int rc;

rc = ds_pool_lookup(arg->pool_uuid, &pool);
rc = DS_POOL_LOOKUP(arg->pool_uuid, &pool);
if (rc != 0) {
D_WARN("Cannot find the pool " DF_UUID " for DTX resync: " DF_RC "\n",
DP_UUID(arg->pool_uuid), DP_RC(rc));
Expand Down Expand Up @@ -846,7 +846,7 @@ dtx_resync_ult(void *data)

out:
if (pool != NULL)
ds_pool_put(pool);
DS_POOL_PUT(&pool);
D_FREE(arg);
}

Expand Down
2 changes: 1 addition & 1 deletion src/engine/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def scons():
'srv_cli.c', 'profile.c', 'rpc.c',
'server_iv.c', 'srv.c', 'srv.pb-c.c',
'sched.c', 'ult.c', 'event.pb-c.c',
'srv_metrics.c'] + libdaos_tgts
'srv_metrics.c', 'util.c'] + libdaos_tgts

if denv["STACK_MMAP"] == 1:
denv.Append(CCFLAGS=['-DULT_MMAP_STACK'])
Expand Down
54 changes: 54 additions & 0 deletions src/engine/util.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* (C) Copyright 2016-2024 Intel Corporation.
* (C) Copyright 2026 Hewlett Packard Enterprise Development LP
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/

#define D_LOGFAC DD_FAC(server)

#include <daos_srv/daos_engine.h>

#ifdef DAOS_WITH_REF_TRACKER

static void
dss_ref_tracker_dumper_ult(void *arg)
{
struct dss_ref_tracker_dumper *dumper = arg;
int n;

for (n = 0; !dss_ult_exiting(dumper->rftd_req); n++) {
if (n % 10 == 0)
d_ref_tracker_dump(dumper->rftd_tracker, dumper->rftd_func,
dumper->rftd_line);
sched_req_sleep(dumper->rftd_req, 1000 /* ms */);
}
}

/** Use DSS_REF_TRACKER_INIT_DUMPER instead. */
void
dss_ref_tracker_init_dumper(struct dss_ref_tracker_dumper *dumper, struct d_ref_tracker *tracker,
const char *func, int line)
{
uuid_t anonym_uuid;
struct sched_req_attr attr;

uuid_clear(anonym_uuid);
sched_req_attr_init(&attr, SCHED_REQ_ANONYM, &anonym_uuid);
dumper->rftd_req = sched_create_ult(&attr, dss_ref_tracker_dumper_ult, dumper, 0);
D_ASSERT(dumper->rftd_req != NULL);

dumper->rftd_tracker = tracker;
dumper->rftd_func = func;
dumper->rftd_line = line;
}

/** Use DSS_REF_TRACKER_FINI_DUMPER instead. */
void
dss_ref_tracker_fini_dumper(struct dss_ref_tracker_dumper *dumper)
{
sched_req_wait(dumper->rftd_req, true);
sched_req_put(dumper->rftd_req);
}

#endif /* DAOS_WITH_REF_TRACKER */
Loading
Loading