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
2 changes: 1 addition & 1 deletion .github/workflows/pmem_tests_3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
Thread:
uses: ./.github/workflows/pmem_test_matrix.yml
with:
force_enable: '["drd", "helgrind"]'
force_enable: '["helgrind"]'
valgrind: 1
# 24h = 1440m (arbitrarily picked in hope it will be enough).
timeout_minutes: 1440
23 changes: 23 additions & 0 deletions .github/workflows/pmem_tests_4.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Run all tests on PMEM.
#
# This workflow is run on 'self-hosted' runners.
name: PMEM tests part 4

on:
workflow_dispatch:
schedule:
# run this job at 6:00 UTC every Monday
- cron: '0 6 * * 1'

permissions: {}

jobs:
# Test the default build with force-enabled Valgrind tooling for thread error
# detection.
Thread:
uses: ./.github/workflows/pmem_test_matrix.yml
with:
force_enable: '["drd"]'
valgrind: 1
# 24h = 1440m (arbitrarily picked in hope it will be enough).
timeout_minutes: 1440
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Fri Jan 16 2026 Oksana Sałyk <[email protected]>

* Version 2.1.3-rc1

- Expand the sds.at_create CTL to also cover the POOL_FEAT_CHECK_BAD_BLOCKS feature (daos-stack/pmdk#28, DAOS-18296).
- Until now, it controlled only the POOL_FEAT_SDS feature, but both may use NDCTL calls and increase stack usage.
- Fix an issue in the PMEMOBJ allocator with a potential to corrupt the allocator's metadata (daos-stack/pmdk#24, DAOS-18195).
- Fix compilation error on LoongArch. Thank you @liuxiang88 and @bgermann for your persistence in making it happen! (daos-stack/pmdk#29, pmem/pmdk#5957).

Tue Nov 4 2025 Oksana Sałyk <[email protected]>

* Version 2.1.2
Expand Down
1 change: 0 additions & 1 deletion GIT_VERSION

This file was deleted.

13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
[![Scans](https://github.com/daos-stack/pmdk/actions/workflows/scans.yml/badge.svg?branch=master)](https://github.com/daos-stack/pmdk/actions/workflows/scans.yml)
[![PMem test 1](https://github.com/daos-stack/pmdk/workflows/PMEM%20tests%20part%201/badge.svg)](https://github.com/daos-stack/pmdk/actions/workflows/pmem_tests_1.yml)
[![PMem test 2](https://github.com/daos-stack/pmdk/workflows/PMEM%20tests%20part%202/badge.svg)](https://github.com/daos-stack/pmdk/actions/workflows/pmem_tests_2.yml)
[![PMem test 3](https://github.com/daos-stack/pmdk/workflows/PMEM%20tests%20part%203/badge.svg)](https://github.com/daos-stack/pmdk/actions/workflows/pmem_tests_3.yml)
[![PMem test 4](https://github.com/daos-stack/pmdk/workflows/PMEM%20tests%20part%204/badge.svg)](https://github.com/daos-stack/pmdk/actions/workflows/pmem_tests_4.yml)

The **Persistent Memory Development Kit (PMDK)** is a collection of libraries and tools for System Administrators and Application Developers to simplify managing and accessing persistent memory devices. For more information, see https://pmem.io.

Expand Down Expand Up @@ -107,10 +109,7 @@ information on this port, contact Rajalakshmi Srinivasaraghavan

## Contact Us

For more information on this library, contact
Tomasz Gromadzki ([email protected]),
Jan Michalski ([email protected]),
Oksana Sałyk ([email protected]),
Piotr Balcer ([email protected]),
Andy Rudoff ([email protected]), or post to
the [Persistent Memory Programming Google group](https://groups.google.com/group/pmem).
For more information on this project, contact
Tomasz Gromadzki ([email protected]),
Jan Michalski ([email protected]), or
Oksana Sałyk ([email protected]).
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.1.3-rc1
4 changes: 4 additions & 0 deletions src/common/set.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause
/* Copyright 2015-2024, Intel Corporation */
/* Copyright 2025, Hewlett Packard Enterprise Development LP */
/*
* Copyright (c) 2016, Microsoft Corporation. All rights reserved.
*
Expand Down Expand Up @@ -3042,6 +3043,9 @@ util_pool_open(struct pool_set **setp, const char *path, size_t minpartsize,
goto err_poolset_free;
}

/* filter out unsupported or turned off features */
compat_features &= attr->features.compat;

if (compat_features & POOL_FEAT_CHECK_BAD_BLOCKS) {
/* check if any bad block recovery file exists */
int bfe = badblocks_recovery_file_exists(set);
Expand Down
2 changes: 1 addition & 1 deletion src/libpmem2/loongarch64/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ pmem2_arch_init(struct pmem2_arch_info *info)
{
LOG(3, NULL);

info->fence = loongarch_fence;
info->fence = loongarch_memory_fence;
info->flush = loongarch_flush;
}
12 changes: 9 additions & 3 deletions src/libpmemobj/memblock.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause
/* Copyright 2016-2024, Intel Corporation */
/* Copyright 2025, Hewlett Packard Enterprise Development LP */

/*
* memblock.c -- implementation of memory block
Expand Down Expand Up @@ -1173,8 +1174,13 @@ huge_write_footer(struct chunk_header *hdr, uint32_t size_idx)
struct chunk_header f = *hdr;
f.type = CHUNK_TYPE_FOOTER;
f.size_idx = size_idx;

/*
* no need to transact and persist,
* footers are recreated in heap_populate_buckets
*/
VALGRIND_ADD_TO_GLOBAL_TX_IGNORE(hdr + size_idx - 1, sizeof(f));
*(hdr + size_idx - 1) = f;
/* no need to persist, footers are recreated in heap_populate_buckets */
VALGRIND_SET_CLEAN(hdr + size_idx - 1, sizeof(f));
}

Expand All @@ -1185,8 +1191,8 @@ static void
huge_reinit_chunk(const struct memory_block *m)
{
struct chunk_header *hdr = heap_get_chunk_hdr(m->heap, m);
if (hdr->type == CHUNK_TYPE_USED)
huge_write_footer(hdr, hdr->size_idx);
ASSERT(hdr->type == CHUNK_TYPE_USED || hdr->type == CHUNK_TYPE_FREE);
huge_write_footer(hdr, hdr->size_idx);
}

/*
Expand Down
1 change: 1 addition & 0 deletions src/libpmemobj/obj.c
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,7 @@ pool_attr_adjust(struct pool_attr *attr)
}
} else {
attr->features.incompat &= ~POOL_FEAT_SDS; /* off */
attr->features.compat &= ~POOL_FEAT_CHECK_BAD_BLOCKS; /* off */
}

return 0;
Expand Down
2 changes: 2 additions & 0 deletions src/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ OBJ_TESTS = \
obj_memcheck\
obj_memcheck_register\
obj_memops\
obj_ndctl_bb\
obj_ndctl_sds\
obj_oid_thread\
obj_out_of_memory\
obj_persist_count\
Expand Down
1 change: 1 addition & 0 deletions src/test/obj_ndctl_bb/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
obj_ndctl_bb
10 changes: 10 additions & 0 deletions src/test/obj_ndctl_bb/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2026, Hewlett Packard Enterprise Development LP

TARGET = obj_ndctl_bb
OBJS = obj_ndctl_bb.o

LIBPMEMOBJ=internal-debug

include ../Makefile.inc
LDFLAGS += $(call extract_funcs, obj_ndctl_bb.c)
30 changes: 30 additions & 0 deletions src/test/obj_ndctl_bb/TEST0
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2026, Hewlett Packard Enterprise Development LP
#
#
# obj_ndctl_bb/TEST0 -- check if the badblocks-related code is not run when no PMem is in use.
# DAOS-18296
#

. ../unittest/unittest.sh

require_fs_type non-pmem
require_ndctl_enable
require_test_type short

setup

FILE=$DIR/testfile

# obj_ndctl_bb commands
CREATE=c
OPEN=o

expect_normal_exit obj_ndctl_bb $FILE $CREATE

expect_normal_exit obj_ndctl_bb $FILE $OPEN

check

pass
40 changes: 40 additions & 0 deletions src/test/obj_ndctl_bb/TEST1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2026, Hewlett Packard Enterprise Development LP
#
#
# obj_ndctl_bb/TEST1 -- check if the executable works as intended. Sanity check.
#

. ../unittest/unittest.sh

require_ndctl_enable
require_test_type short

setup

require_sds ./obj_ndctl_bb

TMP=tmp${UNITTEST_NUM}.log
rm -f $TMP

FILE=$DIR/testfile

# obj_ndctl_bb commands
CREATE=c
OPEN=o

expect_abnormal_exit obj_ndctl_bb $FILE $CREATE
cat $ERR_LOG_FILE >> $TMP

expect_normal_exit $PMEMPOOL$EXESUFFIX create obj $FILE

expect_abnormal_exit obj_ndctl_bb $FILE $OPEN
cat $ERR_LOG_FILE >> $TMP

# move combined error log in place
mv $TMP $ERR_LOG_FILE

check

pass
2 changes: 2 additions & 0 deletions src/test/obj_ndctl_bb/err1.log.match
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{obj_ndctl_bb.c:$(N) __wrap_badblocks_check_poolset} obj_ndctl_bb/TEST1: Error: assertion failure: 0
{obj_ndctl_bb.c:$(N) __wrap_badblocks_recovery_file_exists} obj_ndctl_bb/TEST1: Error: assertion failure: 0
60 changes: 60 additions & 0 deletions src/test/obj_ndctl_bb/obj_ndctl_bb.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// SPDX-License-Identifier: BSD-3-Clause
/* Copyright 2026, Hewlett Packard Enterprise Development LP */

/*
* obj_ndctl_bb.c -- crashes whenever badblocks-related code is run
*/

#include <libpmemobj.h>

#include "set.h"

#include "unittest.h"

FUNC_MOCK(badblocks_recovery_file_exists, int, struct pool_set *set)
FUNC_MOCK_RUN_DEFAULT {
UT_ASSERT(0);
}
FUNC_MOCK_END

FUNC_MOCK(badblocks_check_poolset, int, struct pool_set *set, int create)
FUNC_MOCK_RUN_DEFAULT {
UT_ASSERT(0);
}
FUNC_MOCK_END

int
main(int argc, char *argv[])
{
START(argc, argv, "obj_ndctl_bb");
if (argc < 3) {
UT_FATAL("usage: %s <path> <c|o>\nc - create\no - open",
argv[0]);
}

const char *path = argv[1];
const char *cmd = argv[2];
PMEMobjpool *pop;

if (strlen(cmd) != 1) {
UT_FATAL("unknown command: %s", cmd);
}

switch (cmd[0]) {
case 'c':
pop = pmemobj_create(path, NULL, PMEMOBJ_MIN_POOL,
0600);
break;
case 'o':
pop = pmemobj_open(path, NULL);
break;
default:
UT_FATAL("unknown command: %s", cmd);
}

UT_ASSERTne(pop, NULL);

pmemobj_close(pop);

DONE(NULL);
}
1 change: 1 addition & 0 deletions src/test/obj_ndctl_sds/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
obj_ndctl_sds
10 changes: 10 additions & 0 deletions src/test/obj_ndctl_sds/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2026, Hewlett Packard Enterprise Development LP

TARGET = obj_ndctl_sds
OBJS = obj_ndctl_sds.o

LIBPMEMOBJ=internal-debug

include ../Makefile.inc
LDFLAGS += $(call extract_funcs, obj_ndctl_sds.c)
30 changes: 30 additions & 0 deletions src/test/obj_ndctl_sds/TEST0
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2026, Hewlett Packard Enterprise Development LP
#
#
# obj_ndctl_sds/TEST0 -- check if the shutdown-state-related code is not run when no PMem is in use.
# DAOS-18296
#

. ../unittest/unittest.sh

require_fs_type non-pmem
require_ndctl_enable
require_test_type short

setup

FILE=$DIR/testfile

# obj_ndctl_sds commands
CREATE=c
OPEN=o

expect_normal_exit obj_ndctl_sds $FILE $CREATE

expect_normal_exit obj_ndctl_sds $FILE $OPEN

check

pass
42 changes: 42 additions & 0 deletions src/test/obj_ndctl_sds/TEST1
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2026, Hewlett Packard Enterprise Development LP
#
#
# obj_ndctl_sds/TEST1 -- check if the executable works as intended. Sanity check.
#

. ../unittest/unittest.sh

require_ndctl_enable
require_test_type short

setup

require_sds ./obj_ndctl_sds

TMP=tmp${UNITTEST_NUM}.log
rm -f $TMP

FILE=$DIR/testfile

# obj_ndctl_sds commands
CREATE=c
OPEN=o

expect_abnormal_exit obj_ndctl_sds $FILE $CREATE
cat $ERR_LOG_FILE >> $TMP

# The crashed process leaves $FILE in a half-baked state. Let's do it right.
rm -f $FILE
expect_normal_exit $PMEMPOOL$EXESUFFIX create obj $FILE

expect_abnormal_exit obj_ndctl_sds $FILE $OPEN
cat $ERR_LOG_FILE >> $TMP

# move combined error log in place
mv $TMP $ERR_LOG_FILE

check

pass
2 changes: 2 additions & 0 deletions src/test/obj_ndctl_sds/err1.log.match
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{obj_ndctl_sds.c:$(N) __wrap_shutdown_state_init} obj_ndctl_sds/TEST1: Error: assertion failure: 0
{obj_ndctl_sds.c:$(N) __wrap_shutdown_state_init} obj_ndctl_sds/TEST1: Error: assertion failure: 0
Loading
Loading