Skip to content

Commit

Permalink
DAOS-14903 object: fix bug in peer status check
Browse files Browse the repository at this point in the history
Possibly one target failed but the rank is fine that should not affect
other good targets.

Required-githooks: true

Signed-off-by: Xuezhao Liu <[email protected]>
  • Loading branch information
liuxuezhao committed Jan 10, 2024
1 parent 1ec01fb commit dc1886d
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions src/object/srv_ec_aggregate.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright 2020-2023 Intel Corporation.
* (C) Copyright 2020-2024 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -1302,9 +1302,9 @@ agg_peer_update_ult(void *arg)
iod.iod_size = entry->ae_rsize;
obj = obj_hdl2ptr(entry->ae_obj_hdl);
for (peer = 0; peer < p; peer++) {
/* Only update the available parities */
if (peer == pidx || entry->ae_peer_pshards[peer].sd_rank == DAOS_TGT_IGNORE)
if (peer == pidx)
continue;
D_ASSERT(entry->ae_peer_pshards[peer].sd_rank != DAOS_TGT_IGNORE);
tgt_ep.ep_rank = entry->ae_peer_pshards[peer].sd_rank;
tgt_ep.ep_tag = entry->ae_peer_pshards[peer].sd_tgt_idx;
enqueue_id = 0;
Expand Down Expand Up @@ -1440,6 +1440,7 @@ agg_peer_update(struct ec_agg_entry *entry, bool write_parity)
struct daos_shard_loc *peer_loc;
uint32_t failed_tgts_cnt = 0;
uint32_t p = ec_age2p(entry);
uint32_t pidx = ec_age2pidx(entry);
uint32_t peer;
int i, tid, rc = 0;

Expand All @@ -1461,24 +1462,19 @@ agg_peer_update(struct ec_agg_entry *entry, bool write_parity)
return rc;
}

rc = agg_get_obj_handle(entry);
if (rc) {
D_ERROR("Failed to open object: "DF_RC"\n", DP_RC(rc));
goto out;
}

if (targets != NULL) {
for (peer = 0; peer < p; peer++) {
if (peer == pidx)
continue;
peer_loc = &entry->ae_peer_pshards[peer];
for (i = 0; i < failed_tgts_cnt; i++) {
if (targets[i].ta_comp.co_rank == peer_loc->sd_rank ||
peer_loc->sd_rank == DAOS_TGT_IGNORE) {
D_DEBUG(DB_EPC, DF_UOID" peer parity "
"tgt gailed rank %d, tgt_idx "
"%d.\n", DP_UOID(entry->ae_oid),
peer_loc->sd_rank,
peer_loc->sd_tgt_idx);
goto out;
if (peer_loc->sd_rank == DAOS_TGT_IGNORE ||
(targets[i].ta_comp.co_rank == peer_loc->sd_rank &&
targets[i].ta_comp.co_index == peer_loc->sd_tgt_idx)) {
D_DEBUG(DB_EPC, DF_UOID" peer parity tgt failed rank %d, "
"tgt_idx %d.\n", DP_UOID(entry->ae_oid),
peer_loc->sd_rank, peer_loc->sd_tgt_idx);
D_GOTO(out, rc = -1);
}
}
}
Expand Down Expand Up @@ -1637,7 +1633,10 @@ agg_process_holes_ult(void *arg)
continue;

for (i = 0; targets && i < failed_tgts_cnt; i++) {
if (targets[i].ta_comp.co_rank == entry->ae_peer_pshards[peer].sd_rank) {
if (entry->ae_peer_pshards[peer].sd_rank == DAOS_TGT_IGNORE ||
(targets[i].ta_comp.co_rank == entry->ae_peer_pshards[peer].sd_rank &&
targets[i].ta_comp.co_index ==
entry->ae_peer_pshards[peer].sd_tgt_idx)) {
D_ERROR(DF_UOID" peer %d parity tgt failed\n",
DP_UOID(entry->ae_oid), peer);
rc = -1;
Expand Down

0 comments on commit dc1886d

Please sign in to comment.