Skip to content
Closed
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
30 changes: 10 additions & 20 deletions src/cart/crt_iv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2210,15 +2210,13 @@ crt_ivsync_rpc_issue(struct crt_ivns_internal *ivns_internal, uint32_t class_id,
crt_iv_comp_cb_t update_comp_cb, void *cb_arg,
void *user_priv, int update_rc)
{
crt_rpc_t *corpc_req = NULL;
struct crt_iv_sync_in *input;
int rc = 0;
bool delay_completion = false;
struct iv_sync_cb_info *iv_sync_cb = NULL;
struct crt_iv_ops *iv_ops;
crt_bulk_t local_bulk = CRT_BULK_NULL;
d_rank_list_t excluded_list;
d_rank_t excluded_ranks[1]; /* Excluding self */
struct crt_iv_sync_in *input;
struct crt_iv_ops *iv_ops;
crt_rpc_t *corpc_req = NULL;
struct iv_sync_cb_info *iv_sync_cb = NULL;
crt_bulk_t local_bulk = CRT_BULK_NULL;
int rc = 0;
bool delay_completion = false;

iv_ops = crt_iv_ops_get(ivns_internal, class_id);
D_ASSERT(iv_ops != NULL);
Expand All @@ -2243,10 +2241,6 @@ crt_ivsync_rpc_issue(struct crt_ivns_internal *ivns_internal, uint32_t class_id,
D_GOTO(exit, rc = -DER_INVAL);
}

/* Exclude self from corpc */
excluded_list.rl_nr = 1;
excluded_list.rl_ranks = excluded_ranks;
excluded_ranks[0] = ivns_internal->cii_grp_priv->gp_self;
/* Perform refresh on local node */
if (sync_type->ivs_event == CRT_IV_SYNC_EVENT_UPDATE)
rc = iv_ops->ivo_on_refresh(ivns_internal, iv_key, 0,
Expand All @@ -2273,13 +2267,9 @@ crt_ivsync_rpc_issue(struct crt_ivns_internal *ivns_internal, uint32_t class_id,
}
}

rc = crt_corpc_req_create(ivns_internal->cii_ctx,
&ivns_internal->cii_grp_priv->gp_pub,
&excluded_list,
CRT_OPC_IV_SYNC,
local_bulk, NULL, 0,
ivns_internal->cii_gns.gn_tree_topo,
&corpc_req);
rc = crt_corpc_req_create(ivns_internal->cii_ctx, &ivns_internal->cii_grp_priv->gp_pub,
NULL, CRT_OPC_IV_SYNC, local_bulk, NULL, 0,
ivns_internal->cii_gns.gn_tree_topo, &corpc_req);
if (rc != 0) {
D_ERROR("crt_corpc_req_create(): "DF_RC"\n", DP_RC(rc));
D_GOTO(exit, rc);
Expand Down
89 changes: 53 additions & 36 deletions src/chk/chk_common.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* (C) Copyright 2022-2024 Intel Corporation.
* (C) Copyright 2025 Hewlett Packard Enterprise Development LP
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -183,9 +184,7 @@ btr_ops_t chk_pool_ops = {
struct chk_pending_bundle {
d_list_t *cpb_pool_head;
d_list_t *cpb_rank_head;
d_rank_t cpb_rank;
uuid_t cpb_uuid;
uint32_t cpb_class;
struct chk_report_unit *cpb_cru;
uint64_t cpb_seq;
};

Expand All @@ -210,11 +209,14 @@ chk_pending_alloc(struct btr_instance *tins, d_iov_t *key_iov, d_iov_t *val_iov,
struct chk_pending_bundle *cpb = val_iov->iov_buf;
struct chk_pending_rec *cpr = NULL;
int rc = 0;
int i;
size_t size;

D_ASSERT(cpb != NULL);
D_ASSERT(val_out != NULL);

D_ALLOC_PTR(cpr);
size = sizeof(*cpr) + sizeof(uint32_t) * cpb->cpb_cru->cru_option_nr;
D_ALLOC(cpr, size);
if (cpr == NULL)
D_GOTO(out, rc = -DER_NOMEM);

Expand All @@ -226,11 +228,14 @@ chk_pending_alloc(struct btr_instance *tins, d_iov_t *key_iov, d_iov_t *val_iov,
if (rc != 0)
D_GOTO(out, rc = dss_abterr2der(rc));

uuid_copy(cpr->cpr_uuid, cpb->cpb_uuid);
cpr->cpr_seq = cpb->cpb_seq;
cpr->cpr_rank = cpb->cpb_rank;
cpr->cpr_class = cpb->cpb_class;
cpr->cpr_action = CHK__CHECK_INCONSIST_ACTION__CIA_INTERACT;
uuid_copy(cpr->cpr_uuid, *(cpb->cpb_cru->cru_pool));
cpr->cpr_seq = cpb->cpb_seq;
cpr->cpr_rank = cpb->cpb_cru->cru_rank;
cpr->cpr_class = cpb->cpb_cru->cru_cla;
cpr->cpr_action = CHK__CHECK_INCONSIST_ACTION__CIA_INTERACT;
cpr->cpr_option_nr = cpb->cpb_cru->cru_option_nr;
for (i = 0; i < cpr->cpr_option_nr; i++)
cpr->cpr_options[i] = cpb->cpb_cru->cru_options[i];

if (cpb->cpb_rank_head != NULL)
d_list_add_tail(&cpr->cpr_rank_link, cpb->cpb_rank_head);
Expand Down Expand Up @@ -332,20 +337,15 @@ chk_ranks_dump(uint32_t rank_nr, d_rank_t *ranks)
D_INFO("Ranks List:\n");

while (rank_nr >= 8) {
D_INFO("%8u %8u %8u %8u %8u %8u %8u %8u\n",
ranks[0], ranks[1], ranks[2], ranks[3],
D_INFO("%8u%8u%8u%8u%8u%8u%8u%8u\n", ranks[0], ranks[1], ranks[2], ranks[3],
ranks[4], ranks[5], ranks[6], ranks[7]);
rank_nr -= 8;
ranks += 8;
}

if (rank_nr > 0) {
rc = snprintf(ptr, 79, "%8u", ranks[0]);
D_ASSERT(rc > 0);
ptr += rc;

for (i = 1; i < rank_nr; i++) {
rc = snprintf(ptr, 79 - 8 * i, " %8u", ranks[i]);
for (i = 0; i < rank_nr; i++) {
rc = snprintf(ptr, 79 - 8 * i, "%8u", ranks[i]);
D_ASSERT(rc > 0);
ptr += rc;
}
Expand Down Expand Up @@ -889,8 +889,8 @@ chk_pool_shard_cleanup(struct chk_instance *ins)
}

int
chk_pending_add(struct chk_instance *ins, d_list_t *pool_head, d_list_t *rank_head, uuid_t uuid,
uint64_t seq, uint32_t rank, uint32_t cla, struct chk_pending_rec **cpr)
chk_pending_add(struct chk_instance *ins, d_list_t *pool_head, d_list_t *rank_head,
struct chk_report_unit *cru, uint64_t seq, struct chk_pending_rec **cpr)
{
struct chk_pending_bundle rbund;
d_iov_t kiov;
Expand All @@ -900,12 +900,10 @@ chk_pending_add(struct chk_instance *ins, d_list_t *pool_head, d_list_t *rank_he

D_ASSERT(cpr != NULL);

uuid_copy(rbund.cpb_uuid, uuid);
rbund.cpb_pool_head = pool_head;
rbund.cpb_rank_head = rank_head;
rbund.cpb_seq = seq;
rbund.cpb_rank = rank;
rbund.cpb_class = cla;
rbund.cpb_seq = seq;
rbund.cpb_cru = cru;

d_iov_set(&viov, NULL, 0);
d_iov_set(&riov, &rbund, sizeof(rbund));
Expand All @@ -922,36 +920,55 @@ chk_pending_add(struct chk_instance *ins, d_list_t *pool_head, d_list_t *rank_he
ABT_rwlock_unlock(ins->ci_abt_lock);

D_CDEBUG(rc != 0, DLOG_ERR, DLOG_DBG,
"Add pending record with gen "DF_X64", seq "DF_X64", rank %u, class %u: "DF_RC"\n",
ins->ci_bk.cb_gen, seq, rank, cla, DP_RC(rc));
"Add pending record, gen " DF_X64 ", seq " DF_X64 ", rank %u, cla %u: " DF_RC "\n",
ins->ci_bk.cb_gen, seq, cru->cru_rank, cru->cru_cla, DP_RC(rc));

return rc;
}

int
chk_pending_del(struct chk_instance *ins, uint64_t seq, bool locked, struct chk_pending_rec **cpr)
chk_pending_del(struct chk_instance *ins, uint64_t seq, uint32_t act, bool locked,
struct chk_pending_rec **cpr)
{
d_iov_t kiov;
d_iov_t riov;
int rc;
int i;
bool matched = false;

d_iov_set(&riov, NULL, 0);
d_iov_set(&kiov, &seq, sizeof(seq));

if (!locked)
ABT_rwlock_wrlock(ins->ci_abt_lock);
rc = dbtree_delete(ins->ci_pending_hdl, BTR_PROBE_EQ, &kiov, &riov);
if (!locked)
ABT_rwlock_unlock(ins->ci_abt_lock);
rc = dbtree_lookup(ins->ci_pending_hdl, &kiov, &riov);
if (rc != 0)
goto out;

if (rc == 0)
*cpr = (struct chk_pending_rec *)riov.iov_buf;
*cpr = (struct chk_pending_rec *)riov.iov_buf;
for (i = 0; i < (*cpr)->cpr_option_nr; i++) {
if ((*cpr)->cpr_options[i] == act) {
matched = true;
break;
}
}

if (matched)
rc = dbtree_delete(ins->ci_pending_hdl, BTR_PROBE_EQ | BTR_PROBE_BYPASS, &kiov,
&riov);
else
*cpr = NULL;
rc = -DER_MISMATCH;

out:
if (!locked)
ABT_rwlock_unlock(ins->ci_abt_lock);

D_CDEBUG(rc != 0, DLOG_ERR, DLOG_DBG,
"Del pending record with gen "DF_X64", seq "DF_X64": "DF_RC"\n",
ins->ci_bk.cb_gen, seq, DP_RC(rc));
"Del pending record, gen " DF_X64 ", seq " DF_X64 ", act %u: " DF_RC "\n",
ins->ci_bk.cb_gen, seq, act, DP_RC(rc));

if (rc != 0)
*cpr = NULL;

return rc;
}
Expand Down Expand Up @@ -1032,9 +1049,9 @@ chk_prop_prepare(d_rank_t leader, uint32_t flags, int phase,

/* Reuse former policies if "policy_nr == 0". */
if (policy_nr > 0) {
memset(prop->cp_policies, 0, sizeof(Chk__CheckInconsistAction) * CHK_POLICY_MAX);
memset(prop->cp_policies, 0, sizeof(Chk__CheckInconsistAction) * CHK_CLASS_MAX);
for (i = 0; i < policy_nr; i++) {
if (unlikely(policies[i].cp_class >= CHK_POLICY_MAX)) {
if (unlikely(policies[i].cp_class >= CHK_CLASS_MAX)) {
D_ERROR("Invalid DAOS inconsistency class %u\n",
policies[i].cp_class);
D_GOTO(out, rc = -DER_INVAL);
Expand Down
48 changes: 23 additions & 25 deletions src/chk/chk_engine.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* (C) Copyright 2022-2024 Intel Corporation.
* (C) Copyright 2025 Hewlett Packard Enterprise Development LP
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -2642,7 +2643,7 @@ chk_engine_act_internal(struct chk_instance *ins, uint64_t seq, uint32_t act, bo
struct chk_pending_rec *cpr = NULL;
int rc;

rc = chk_pending_del(ins, seq, locked, &cpr);
rc = chk_pending_del(ins, seq, act, locked, &cpr);
if (rc == 0) {
/* The cpr will be destroyed by the waiter via chk_engine_report(). */
D_ASSERT(cpr->cpr_busy);
Expand Down Expand Up @@ -2674,12 +2675,13 @@ chk_engine_act(uint64_t gen, uint64_t seq, uint32_t cla, uint32_t act, uint32_t
struct chk_pool_rec *pool_tmp = NULL;
struct chk_pending_rec *cpr = NULL;
struct chk_pending_rec *cpr_tmp = NULL;
int rc;
int rc = 0;
int rc1;

if (ins->ci_bk.cb_gen != gen)
D_GOTO(out, rc = -DER_NOTAPPLICABLE);

if (unlikely(cla >= CHK_POLICY_MAX)) {
if (unlikely(cla >= CHK_CLASS_MAX)) {
D_ERROR("Invalid DAOS inconsistency class %u\n", cla);
D_GOTO(out, rc = -DER_INVAL);
}
Expand All @@ -2690,12 +2692,12 @@ chk_engine_act(uint64_t gen, uint64_t seq, uint32_t cla, uint32_t act, uint32_t
D_GOTO(out, rc = -DER_INVAL);
}

rc = chk_engine_act_internal(ins, seq, act, false);
if (rc == -DER_NONEXIST || rc == -DER_NO_HDL)
rc = 0;

if (rc != 0 || !(flags & CAF_FOR_ALL))
if (!(flags & CAF_FOR_ALL)) {
rc = chk_engine_act_internal(ins, seq, act, false);
if (rc == -DER_NONEXIST || rc == -DER_NO_HDL)
rc = 0;
goto out;
}

if (likely(prop->cp_policies[cla] != act)) {
prop->cp_policies[cla] = act;
Expand All @@ -2709,23 +2711,20 @@ chk_engine_act(uint64_t gen, uint64_t seq, uint32_t cla, uint32_t act, uint32_t
d_list_for_each_entry(pool, &ins->ci_pool_list, cpr_link)
chk_pool_get(pool);

ABT_rwlock_wrlock(ins->ci_abt_lock);
d_list_for_each_entry_safe(pool, pool_tmp, &ins->ci_pool_list, cpr_link) {
if (rc == 0) {
ABT_rwlock_wrlock(ins->ci_abt_lock);
d_list_for_each_entry_safe(cpr, cpr_tmp, &pool->cpr_pending_list,
cpr_pool_link) {
if (cpr->cpr_class != cla ||
cpr->cpr_action != CHK__CHECK_INCONSIST_ACTION__CIA_INTERACT)
continue;

rc = chk_engine_act_internal(ins, cpr->cpr_seq, act, true);
if (rc != 0)
break;
}
ABT_rwlock_unlock(ins->ci_abt_lock);
d_list_for_each_entry_safe(cpr, cpr_tmp, &pool->cpr_pending_list, cpr_pool_link) {
if (cpr->cpr_class != cla ||
cpr->cpr_action != CHK__CHECK_INCONSIST_ACTION__CIA_INTERACT)
continue;

rc1 = chk_engine_act_internal(ins, cpr->cpr_seq, act, true);
if (rc1 != 0 && rc == 0)
rc = rc1;
}
chk_pool_put(pool);
}
ABT_rwlock_unlock(ins->ci_abt_lock);

out:
D_CDEBUG(rc != 0, DLOG_ERR, DLOG_INFO,
Expand Down Expand Up @@ -3148,8 +3147,7 @@ chk_engine_report(struct chk_report_unit *cru, uint64_t *seq, int *decision)

pool = (struct chk_pool_rec *)riov.iov_buf;

rc = chk_pending_add(ins, &pool->cpr_pending_list, NULL, *cru->cru_pool, *seq,
cru->cru_rank, cru->cru_cla, &cpr);
rc = chk_pending_add(ins, &pool->cpr_pending_list, NULL, cru, *seq, &cpr);
if (unlikely(rc == -DER_AGAIN))
goto new_seq;

Expand All @@ -3166,9 +3164,9 @@ chk_engine_report(struct chk_report_unit *cru, uint64_t *seq, int *decision)
if (unlikely(rc == -DER_AGAIN)) {
D_ASSERT(cru->cru_act == CHK__CHECK_INCONSIST_ACTION__CIA_INTERACT);

rc = chk_pending_del(ins, *seq, false, &tmp);
rc = chk_pending_del(ins, *seq, cru->cru_options[0], false, &tmp);
if (rc == 0)
D_ASSERT(tmp == NULL);
D_ASSERT(tmp == cpr);
else if (rc != -DER_NONEXIST)
goto log;

Expand Down
Loading
Loading