From 9ae46bec7c6e3a91d5e55baade99666f8a383040 Mon Sep 17 00:00:00 2001 From: Wang Shilong Date: Fri, 10 Jul 2026 09:34:08 +0000 Subject: [PATCH] DAOS-18742 rebuild: Ignore destroyed containers during migration If a container still exists locally but the remote fetch returns DER_CONT_DESTROYING or DER_CONT_NONEXIST, the error is unexpectedly stored in mpt_status and causes rebuild to fail. A similar issue can happen during punch, so ignore these container-gone errors there as well. Signed-off-by: Wang Shilong Signed-off-by: Mohamad Chaarawi --- src/object/srv_obj_migrate.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/object/srv_obj_migrate.c b/src/object/srv_obj_migrate.c index 7ae608029d3..a339d3b7834 100644 --- a/src/object/srv_obj_migrate.c +++ b/src/object/srv_obj_migrate.c @@ -73,6 +73,12 @@ enum { }; #define MIGRATE_DATA_MB_ENV "D_MIGRATE_DATA_MB" +static inline bool +migrate_cont_gone(int rc) +{ + return rc == -DER_CONT_NONEXIST || rc == -DER_CONT_DESTROYING; +} + struct migr_res_manager; /* resource consumed by migration */ @@ -3066,6 +3072,8 @@ migrate_obj_punch_one(void *data) DL_ERROR(rc, DF_RB ": " DF_UOID " migrate punch failed", DP_RB_MPT(tls), DP_UOID(arg->oid)); + if (migrate_cont_gone(rc)) + rc = 0; if (tls->mpt_status == 0 && rc != 0) tls->mpt_status = rc; @@ -3591,23 +3599,13 @@ migrate_obj_ult(void *data) if (arg->epoch == DAOS_EPOCH_MAX) tls->mpt_obj_count++; - if (rc == -DER_CONT_NONEXIST || rc == -DER_CONT_DESTROYING) { - struct ds_cont_child *cont_child = NULL; - - /* check again to see if the container is being destroyed. */ - migrate_get_cont_child(tls, arg->cont_uuid, &cont_child, false); - if (cont_child == NULL || cont_child->sc_stopping) - rc = 0; - - if (cont_child) - ds_cont_child_put(cont_child); - } - if (DAOS_FAIL_CHECK(DAOS_REBUILD_OBJ_FAIL) && tls->mpt_obj_count >= daos_fail_value_get()) rc = -DER_IO; out: + if (migrate_cont_gone(rc)) + rc = 0; if (tls->mpt_status == 0 && rc < 0) tls->mpt_status = rc; @@ -3849,7 +3847,7 @@ migrate_cont_iter_cb(daos_handle_t ih, d_iov_t *key_iov, rc = dss_ult_execute(cont_fetch_start_ult, &fetch_arg, NULL, NULL, DSS_XS_SYS, 0, MIGRATE_STACK_SIZE); if (rc) { - if (rc == -DER_CONT_NONEXIST) { + if (migrate_cont_gone(rc)) { DL_INFO(rc, DF_RB ": " DF_CONT " skip orphan container", DP_RB_MPT(tls), DP_CONT(tls->mpt_pool_uuid, cont_uuid)); D_GOTO(cont_done, rc = 0);