Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

CORTX-33537: allow degraded i/o for the new objects #1959

Merged
merged 4 commits into from
Jul 11, 2022
Merged
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
15 changes: 12 additions & 3 deletions conf/pvers.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ static int conf_pver_find_locked(const struct m0_conf_pool *pool,
if (rc != 0)
return M0_ERR_INFO(rc, "Recd update failed for pool "FID_F,
FID_P(&pool->pl_obj.co_id));
*out = NULL;
m0_tl_for (m0_conf_dir, &pool->pl_pvers->cd_items, obj) {
pver = M0_CONF_CAST(obj, m0_conf_pver);
M0_LOG(M0_DEBUG, "pver="FID_F, FID_P(&pver->pv_obj.co_id));
Expand All @@ -145,14 +146,22 @@ static int conf_pver_find_locked(const struct m0_conf_pool *pool,
M0_LOG(M0_INFO, "Skipping "FID_F, FID_P(pver_to_skip));
continue;
}
if (pver->pv_kind == M0_CONF_PVER_ACTUAL)
*out = pver; /* cache it for now */
if (!m0_conf_pver_is_clean(pver))
continue;
if (pver->pv_kind == M0_CONF_PVER_ACTUAL) {
*out = pver;
if (pver->pv_kind == M0_CONF_PVER_ACTUAL)
return M0_RC(0);
}
return M0_RC(conf_pver_formulate(pver, out));
} m0_tl_endfor;

/*
* Return the actual pver if we cannot find anything better.
* The I/O will be performed in the degraded mode.
*/
if (*out != NULL)
return M0_RC(0);

return M0_ERR_INFO(-ENOENT, "No suitable pver is found at pool "FID_F,
FID_P(&pool->pl_obj.co_id));
}
Expand Down
3 changes: 2 additions & 1 deletion conf/ut/pvers.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ static void test_pver_find(void)

conf_ut_ha_state_set(cache, &failed[0], M0_NC_FAILED);
rc = m0_conf_pver_find(pool, NULL, &pver);
M0_UT_ASSERT(rc == -ENOENT);
M0_UT_ASSERT(rc == 0);
M0_UT_ASSERT(pver->pv_kind == M0_CONF_PVER_ACTUAL);
for (i = 1; i < ARRAY_SIZE(failed); ++i)
conf_ut_ha_state_set(cache, &failed[i], M0_NC_FAILED);
rc = m0_conf_pver_find(pool, NULL, &pver_virt);
Expand Down