Skip to content

Commit

Permalink
CORTX-33537: allow degraded i/o for the new objects
Browse files Browse the repository at this point in the history
Currently, if no clean pool version (actual or formulaic)
can be found for the new object on its creation, -ENOENT is
returned, which is not good. We want the user to be able to
create new objects even if this implies the degraded i/o on
them.

Solution: return the actual pver at conf_pver_find_locked()
in case when nothing better (cleaner) can be found.

Closes Seagate#1958.
Relates Seagate/cortx-hare#2123.

Signed-off-by: Andriy Tkachuk <andriy.tkachuk@seagate.com>
  • Loading branch information
andriytk committed Jul 7, 2022
1 parent 275f821 commit 7c2b423
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
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

0 comments on commit 7c2b423

Please sign in to comment.