11/**
22 * (C) Copyright 2022-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 */
@@ -226,9 +226,10 @@ static void
226226chk_leader_exit (struct chk_instance * ins , uint32_t ins_phase , uint32_t ins_status ,
227227 uint32_t pool_status , bool bcast )
228228{
229- struct chk_bookmark * cbk = & ins -> ci_bk ;
230- struct chk_iv iv = { 0 };
231- int rc = 0 ;
229+ struct chk_dead_rank * cdr ;
230+ struct chk_bookmark * cbk = & ins -> ci_bk ;
231+ struct chk_iv iv = {0 };
232+ int rc = 0 ;
232233
233234 ins -> ci_sched_exiting = 1 ;
234235
@@ -237,8 +238,7 @@ chk_leader_exit(struct chk_instance *ins, uint32_t ins_phase, uint32_t ins_statu
237238 chk_pool_stop_all (ins , pool_status , NULL );
238239
239240 if ((bcast && ins_status == CHK__CHECK_INST_STATUS__CIS_FAILED ) ||
240- ins_status == CHK__CHECK_INST_STATUS__CIS_IMPLICATED ||
241- unlikely (ins_status == CHK__CHECK_INST_STATUS__CIS_COMPLETED && !ins -> ci_orphan_done )) {
241+ ins_status == CHK__CHECK_INST_STATUS__CIS_IMPLICATED || !ins -> ci_orphan_done ) {
242242 iv .ci_gen = cbk -> cb_gen ;
243243 iv .ci_phase = ins_phase != CHK_INVAL_PHASE ? ins_phase : cbk -> cb_phase ;
244244 iv .ci_ins_status = ins_status ;
@@ -264,6 +264,10 @@ chk_leader_exit(struct chk_instance *ins, uint32_t ins_phase, uint32_t ins_statu
264264 DP_LEADER (ins ), ins_status , DP_RC (rc ));
265265 }
266266
267+ while ((cdr = d_list_pop_entry (& ins -> ci_dead_ranks , struct chk_dead_rank , cdr_link )) !=
268+ NULL )
269+ D_FREE (cdr );
270+
267271 ins -> ci_sched_exiting = 0 ;
268272}
269273
@@ -305,31 +309,24 @@ chk_leader_post_repair(struct chk_instance *ins, struct chk_pool_rec *cpr,
305309 DP_UUID (cpr -> cpr_uuid ), rc );
306310 }
307311
308- /*
309- * If the operation failed and 'failout' is set, then do nothing here.
310- * chk_leader_exit will handle all the IV and bookmark related things.
311- */
312- if (* result == 0 || !(ins -> ci_prop .cp_flags & CHK__CHECK_FLAG__CF_FAILOUT )) {
313- if (notify ) {
314- iv .ci_gen = cbk -> cb_gen ;
315- uuid_copy (iv .ci_uuid , cpr -> cpr_uuid );
316- iv .ci_ins_status = ins -> ci_bk .cb_ins_status ;
317- iv .ci_phase = cbk -> cb_phase ;
318- iv .ci_pool_status = cbk -> cb_pool_status ;
319-
320- /* Synchronously notify the engines that check on the pool got failure. */
321- rc = chk_iv_update (ins -> ci_iv_ns , & iv , CRT_IV_SHORTCUT_NONE ,
322- CRT_IV_SYNC_EAGER , true);
323- D_CDEBUG (rc != 0 , DLOG_ERR , DLOG_INFO ,
324- DF_LEADER " notify the engines that the check for pool "
325- DF_UUIDF " is done with status %u: rc = %d\n" ,
326- DP_LEADER (ins ), DP_UUID (cpr -> cpr_uuid ), iv .ci_pool_status , rc );
327- if (rc == 0 )
328- cpr -> cpr_notified_exit = 1 ;
329- }
312+ if (notify ) {
313+ uuid_copy (iv .ci_uuid , cpr -> cpr_uuid );
314+ iv .ci_gen = cbk -> cb_gen ;
315+ iv .ci_ins_status = ins -> ci_bk .cb_ins_status ;
316+ iv .ci_phase = cbk -> cb_phase ;
317+ iv .ci_pool_status = cbk -> cb_pool_status ;
318+
319+ rc = chk_iv_update (ins -> ci_iv_ns , & iv , CRT_IV_SHORTCUT_NONE , CRT_IV_SYNC_EAGER ,
320+ true);
321+ DL_CDEBUG (rc != 0 , DLOG_WARN , DLOG_INFO , rc ,
322+ DF_LEADER " notify engines that check pool " DF_UUIDF " done, status %u" ,
323+ DP_LEADER (ins ), DP_UUID (cpr -> cpr_uuid ), iv .ci_pool_status );
324+ if (rc == 0 )
325+ cpr -> cpr_notified_exit = 1 ;
326+ }
330327
328+ if (!(ins -> ci_prop .cp_flags & CHK__CHECK_FLAG__CF_FAILOUT ))
331329 * result = 0 ;
332- }
333330
334331 if (update ) {
335332 rc = chk_bk_update_leader (& ins -> ci_bk );
@@ -2284,7 +2281,8 @@ chk_leader_sched(void *args)
22842281
22852282 ins_phase = chk_pools_find_slowest (ins , & done );
22862283
2287- if (ins_phase >= CHK__CHECK_SCAN_PHASE__CSP_POOL_MBS && !ins -> ci_orphan_done &&
2284+ if (ins_phase != CHK_INVAL_PHASE &&
2285+ ins_phase >= CHK__CHECK_SCAN_PHASE__CSP_POOL_MBS && !ins -> ci_orphan_done &&
22882286 !DAOS_FAIL_CHECK (DAOS_CHK_SYNC_ORPHAN_PROCESS )) {
22892287 iv .ci_gen = cbk -> cb_gen ;
22902288 iv .ci_phase = ins_phase ;
@@ -2316,7 +2314,7 @@ chk_leader_sched(void *args)
23162314 D_GOTO (out , rc );
23172315 }
23182316
2319- if (cbk -> cb_phase == CHK_INVAL_PHASE || cbk -> cb_phase < ins_phase ) {
2317+ if (ins_phase != CHK_INVAL_PHASE && ins_phase > cbk -> cb_phase ) {
23202318 D_INFO (DF_LEADER " moves from phase %u to phase %u\n" ,
23212319 DP_LEADER (ins ), cbk -> cb_phase , ins_phase );
23222320
0 commit comments