From 50c9342895ea6bc45da08124d5058b190efa2f1a Mon Sep 17 00:00:00 2001 From: Li Wei Date: Tue, 11 Jun 2024 19:22:07 +0900 Subject: [PATCH] DAOS-15968 container: Fix CAPA fetch on NS master (#14511) Apparently, when an I/O request fetches a container handle on the engine who is the PS leader, if the ds_cont_hdl object is absent (because the engine has restarted), then the cont_iv code won't create a ds_cont_hdl object, even though the handle is found in the RDB. This patch adds a ds_cont_tgt_open call to cont_iv_ent_fetch, so that the flow is similar to cont_iv_ent_update. Signed-off-by: Li Wei --- src/container/container_iv.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/container/container_iv.c b/src/container/container_iv.c index 21bc95ea6af..2ccb5b75d4b 100644 --- a/src/container/container_iv.c +++ b/src/container/container_iv.c @@ -497,8 +497,15 @@ cont_iv_ent_fetch(struct ds_iv_entry *entry, struct ds_iv_key *key, } prop_entry = daos_prop_entry_get(prop, DAOS_PROP_CO_STATUS); D_ASSERT(prop_entry != NULL); - daos_prop_val_2_co_status(prop_entry->dpe_val, &stat); + + rc = ds_cont_tgt_open(entry->ns->iv_pool_uuid, + civ_key->cont_uuid, chdl.ch_cont, + chdl.ch_flags, chdl.ch_sec_capas, + stat.dcs_pm_ver); + if (rc != 0) + D_GOTO(out, rc); + iv_entry.iv_capa.status_pm_ver = stat.dcs_pm_ver; daos_prop_free(prop); /* Only happens on xstream 0 */ @@ -510,6 +517,11 @@ cont_iv_ent_fetch(struct ds_iv_entry *entry, struct ds_iv_key *key, rc = dbtree_update(root_hdl, &key_iov, &val_iov); if (rc == 0) goto again; + /* + * It seems that not rolling back the ds_cont_tgt_open call + * above is harmless. Also, an error from the dbtree_update + * call should be rare. + */ } else { rc = -DER_NONEXIST; }