Skip to content
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
1 change: 1 addition & 0 deletions src/common/dav/dav_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ typedef struct dav_obj {
static inline
struct dav_tx *utx2wtx(struct umem_wal_tx *utx)
{
D_ASSERT(utx != NULL);
return (struct dav_tx *)&utx->utx_private;
}

Expand Down
19 changes: 19 additions & 0 deletions src/common/dav/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,8 @@ dav_reserve(dav_obj_t *pop, struct dav_action *act, size_t size, uint64_t type_n

if (palloc_reserve(pop->do_heap, size, NULL, NULL, type_num,
0, 0, 0, act) != 0) {
if (!tx_inprogress)
lw_tx_end(pop, NULL);
DAV_API_END();
return 0;
}
Expand Down Expand Up @@ -1565,9 +1567,26 @@ dav_publish(dav_obj_t *pop, struct dav_action *actv, size_t actvcnt)
void
dav_cancel(dav_obj_t *pop, struct dav_action *actv, size_t actvcnt)
{
int rc, tx_inprogress = 0;

DAV_DBG("actvcnt=%zu", actvcnt);
if (get_tx()->stage != DAV_TX_STAGE_NONE)
tx_inprogress = 1;

DAV_API_START();
if (!tx_inprogress) {
rc = lw_tx_begin(pop);
if (rc) {
D_ERROR("Failed to start local tx. %d\n", rc);
return;
}
}

palloc_cancel(pop->do_heap, actv, actvcnt);

if (!tx_inprogress)
lw_tx_end(pop, NULL);

DAV_API_END();
}

Expand Down
5 changes: 3 additions & 2 deletions src/common/tests/umem_test_bmem.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* (C) Copyright 2019-2023 Intel Corporation.
* (C) Copyright 2023 Hewlett Packard Enterprise Development LP.
* (C) Copyright 2023-2025 Hewlett Packard Enterprise Development LP.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -1193,7 +1193,8 @@ test_tx_reserve_publish_cancel(void **state)
assert_int_equal(memcmp(rsrv_ptr1, local_buf, 980), 0);
assert_int_equal(memcmp(rsrv_ptr2, local_buf, 128), 0);
umem_cancel(umm, rsrvd_act);
validate_persist_activity(1, 0);
/* umem_cacnel() internally started tx, which increased one additional resrv_cnt */
validate_persist_activity(2, 0);
utest_get_scm_used_space(arg->ta_utx, &cur_mem_used);
assert_true(cur_mem_used >= initial_mem_used);
umoff = umem_atomic_alloc(umm, 980, UMEM_TYPE_ANY);
Expand Down
Loading