Skip to content

Commit a7e9aa4

Browse files
authored
DAOS-18866 vos: unconditional punch fix (#18219)
Return DER_NONEXIST error when object doesn't exist for unconditional puch case. This patch also fixed vos_obj_incarnate() to return DER_NONEXIST error when CREATE flag isn't present. Signed-off-by: Niu Yawei <yawei.niu@hpe.com>
1 parent 21fe90d commit a7e9aa4

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/vos/vos_obj.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,16 @@ vos_obj_punch(daos_handle_t coh, daos_unit_oid_t oid, daos_epoch_t epoch,
494494
if (rc != 0)
495495
goto reset;
496496

497+
if (!(hold_flags & VOS_OBJ_CREATE) && (obj->obj_df == NULL)) {
498+
rc = vos_ilog_ts_add(ts_set, NULL, &oid, sizeof(oid));
499+
D_ASSERT(rc == 0);
500+
501+
rc = -DER_NONEXIST;
502+
vos_obj_release(obj, 0, true);
503+
obj = NULL;
504+
goto reset;
505+
}
506+
497507
rc = vos_tx_begin(dth, vos_cont2umm(cont), cont->vc_pool->vp_sysdb, obj);
498508
if (rc != 0)
499509
goto reset;

src/vos/vos_obj_cache.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,8 @@ vos_obj_incarnate(struct vos_object *obj, daos_epoch_range_t *epr, daos_epoch_t
545545
if (rc == 0) {
546546
obj->obj_sync_epoch = obj->obj_df->vo_sync;
547547
} else if (rc == -DER_NONEXIST) {
548+
if (!(flags & VOS_OBJ_CREATE))
549+
return -DER_NONEXIST;
548550
rc = vos_oi_alloc(cont, obj->obj_id, epr->epr_hi, &obj->obj_df, ts_set);
549551
if (rc) {
550552
DL_ERROR(rc, DF_CONT ": Failed to allocate OI " DF_UOID ".",

0 commit comments

Comments
 (0)