Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAOS-16211 vos: Avoid race condition with discard (#15370) #15432

Merged
merged 3 commits into from
Nov 5, 2024
Merged
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
31 changes: 22 additions & 9 deletions src/vos/vos_obj_index.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,13 +791,14 @@ oi_iter_process(struct vos_iterator *iter, vos_iter_proc_op_t op, void *args)
int
oi_iter_check_punch(daos_handle_t ih)
{
struct vos_iterator *iter = vos_hdl2iter(ih);
struct vos_oi_iter *oiter = iter2oiter(iter);
struct vos_obj_df *obj;
struct oi_delete_arg del_arg;
daos_unit_oid_t oid;
d_iov_t rec_iov;
int rc;
struct vos_iterator *iter = vos_hdl2iter(ih);
struct vos_oi_iter *oiter = iter2oiter(iter);
struct vos_container *cont = oiter->oit_cont;
struct vos_obj_df *obj;
struct oi_delete_arg del_arg;
daos_unit_oid_t oid;
d_iov_t rec_iov;
int rc;

D_ASSERT(iter->it_type == VOS_ITER_OBJ);

Expand All @@ -811,10 +812,22 @@ oi_iter_check_punch(daos_handle_t ih)
obj = (struct vos_obj_df *)rec_iov.iov_buf;
oid = obj->vo_id;

if (!vos_ilog_is_punched(vos_cont2hdl(oiter->oit_cont), &obj->vo_ilog, &oiter->oit_epr,
NULL, &oiter->oit_ilog_info))
if (!vos_ilog_is_punched(vos_cont2hdl(cont), &obj->vo_ilog, &oiter->oit_epr, NULL,
&oiter->oit_ilog_info))
return 0;

rc = vos_obj_hold(vos_obj_cache_current(cont->vc_pool->vp_sysdb), cont, oid,
&oiter->oit_epr, iter->it_bound, VOS_OBJ_AGGREGATE | VOS_OBJ_NO_HOLD,
DAOS_INTENT_PURGE, NULL, NULL);
if (rc != 0) {
/** -DER_BUSY means the object is in-use already. We will after a yield in this
* case.
*/
D_CDEBUG(rc == -DER_BUSY, DB_EPC, DLOG_ERR, "Hold check failed for " DF_UOID "\n",
DP_UOID(oid));
return rc;
}

/** Ok, ilog is fully punched, so we can move it to gc heap */
rc = umem_tx_begin(vos_cont2umm(oiter->oit_cont), NULL);
if (rc != 0)
Expand Down
Loading