diff --git a/debian/changelog b/debian/changelog index 484b32f3533..b1d9f8eeb76 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,20 @@ -daos (2.7.101-3) unstable; urgency=medium +daos (2.7.101-5) unstable; urgency=medium + [ Tomasz Gromadzki ] + * pmemobj errors and warnings reported via DAOS logging system + + -- Tomasz Gromadzki Tue, 14 Jan 2025 12:00:00 +0200 + +daos (2.7.101-4) unstable; urgency=medium [ Jeff Olivier ] * Switch from libfuse3 to libfused - -- Jeff Olivier Thu, 19 Dec 2024 20:15:00 +0000 + -- Jeff Olivier Fri, 20 Dec 2024 20:15:00 +0000 + +daos (2.7.101-3) unstable; urgency=medium + [ Phillip Henderson ] + * Fix protobuf-c requiremnent for daos-client-tests on Leap. + + -- Phillip Henderson Thu, 19 Dec 2024 13:05:00 -0500 daos (2.7.101-2) unstable; urgency=medium [ Denis Barakhtanov ] @@ -24,7 +36,6 @@ daos (2.7.100-11) unstable; urgency=medium -- Michael MacDonald Tue, 5 Nov 2024 12:00:00 -0500 daos (2.7.100-10) unstable; urgency=medium - [ Sherin T George ] * Add DAV v2 lib diff --git a/src/include/daos/debug.h b/src/include/daos/debug.h index bcf8834c517..175c129ff29 100644 --- a/src/include/daos/debug.h +++ b/src/include/daos/debug.h @@ -1,5 +1,6 @@ /** - * (C) Copyright 2015-2023 Intel Corporation. + * (C) Copyright 2015-2024 Intel Corporation. + * (C) Copyright 2025 Hewlett Packard Enterprise Development LP * * SPDX-License-Identifier: BSD-2-Clause-Patent */ @@ -23,37 +24,37 @@ * predefined debug facilities (subsystems/modules), they have to be declared * before including any libgurt headers */ -#define DAOS_FOREACH_LOG_FAC(ACTION, arg) \ - ACTION(daos, daos, arg) \ - ACTION(array, array, arg) \ - ACTION(kv, kv, arg) \ - ACTION(common, common, arg) \ - ACTION(tree, tree, arg) \ - ACTION(vos, vos, arg) \ - ACTION(client, client, arg) \ - ACTION(server, server, arg) \ - ACTION(rdb, rdb, arg) \ - ACTION(rsvc, rsvc, arg) \ - ACTION(pool, pool, arg) \ - ACTION(container, container, arg) \ - ACTION(object, object, arg) \ - ACTION(placement, placement, arg) \ - ACTION(rebuild, rebuild, arg) \ - ACTION(mgmt, mgmt, arg) \ - ACTION(bio, bio, arg) \ - ACTION(tests, tests, arg) \ - ACTION(dfs, dfs, arg) \ - ACTION(duns, duns, arg) \ - ACTION(drpc, drpc, arg) \ - ACTION(security, security, arg) \ - ACTION(dtx, dtx, arg) \ - ACTION(chk, chk, arg) \ - ACTION(dfuse, dfuse, arg) \ - ACTION(il, il, arg) \ - ACTION(csum, csum, arg) \ - ACTION(pipeline, pipeline, arg) \ - ACTION(stack, stack, arg) - +#define DAOS_FOREACH_LOG_FAC(ACTION, arg) \ + ACTION(daos, daos, arg) \ + ACTION(array, array, arg) \ + ACTION(kv, kv, arg) \ + ACTION(common, common, arg) \ + ACTION(tree, tree, arg) \ + ACTION(vos, vos, arg) \ + ACTION(pmdk, pmdk, arg) \ + ACTION(client, client, arg) \ + ACTION(server, server, arg) \ + ACTION(rdb, rdb, arg) \ + ACTION(rsvc, rsvc, arg) \ + ACTION(pool, pool, arg) \ + ACTION(container, container, arg) \ + ACTION(object, object, arg) \ + ACTION(placement, placement, arg) \ + ACTION(rebuild, rebuild, arg) \ + ACTION(mgmt, mgmt, arg) \ + ACTION(bio, bio, arg) \ + ACTION(tests, tests, arg) \ + ACTION(dfs, dfs, arg) \ + ACTION(duns, duns, arg) \ + ACTION(drpc, drpc, arg) \ + ACTION(security, security, arg) \ + ACTION(dtx, dtx, arg) \ + ACTION(chk, chk, arg) \ + ACTION(dfuse, dfuse, arg) \ + ACTION(il, il, arg) \ + ACTION(csum, csum, arg) \ + ACTION(pipeline, pipeline, arg) \ + ACTION(stack, stack, arg) #define DAOS_FOREACH_DB(ACTION, arg) \ /** metadata operation */ \ diff --git a/src/include/gurt/debug.h b/src/include/gurt/debug.h index e47f4ab0cd9..df6e9f48e42 100644 --- a/src/include/gurt/debug.h +++ b/src/include/gurt/debug.h @@ -1,5 +1,7 @@ /* * (C) Copyright 2017-2023 Intel Corporation. + * (C) Copyright 2025 Google LLC + * (C) Copyright 2025 Hewlett Packard Enterprise Development LP * * SPDX-License-Identifier: BSD-2-Clause-Patent */ @@ -97,20 +99,20 @@ extern void (*d_alt_assert)(const int, const char*, const char*, const int); _D_LOG_CHECK(func, __tmp_mask, mask, ##__VA_ARGS__); \ } while (0) -#define _D_DEBUG(func, flag, ...) \ - do { \ - if (__builtin_expect(DD_FLAG(flag, D_LOGFAC), 0)) { \ - if (DD_FLAG(flag, D_LOGFAC) == (int)DLOG_UNINIT) { \ - _D_LOG_CHECK(func, \ - DD_FLAG(flag, D_LOGFAC), \ - (flag) | D_LOGFAC, \ - ##__VA_ARGS__); \ - break; \ - } \ - func(DD_FLAG(flag, D_LOGFAC), ##__VA_ARGS__); \ - } \ +#define _D_DEBUG_W_SAVED_MASK(func, saved_mask, level, ...) \ + do { \ + if (__builtin_expect(saved_mask, 0)) { \ + if ((saved_mask) == (int)DLOG_UNINIT) { \ + _D_LOG_CHECK(func, saved_mask, (level) | D_LOGFAC, ##__VA_ARGS__); \ + break; \ + } \ + func(saved_mask, ##__VA_ARGS__); \ + } \ } while (0) +#define _D_DEBUG(func, flag, ...) \ + _D_DEBUG_W_SAVED_MASK(func, DD_FLAG(flag, D_LOGFAC), flag, ##__VA_ARGS__) + #define D_LOG_ENABLED(flag) \ ({ \ _D_DEBUG(D_NOOP, flag); \ diff --git a/src/vos/SConscript b/src/vos/SConscript index d91a2f3028a..0e4d69bbf9f 100644 --- a/src/vos/SConscript +++ b/src/vos/SConscript @@ -6,7 +6,7 @@ FILES = ["evt_iter.c", "vos_common.c", "vos_iterator.c", "vos_io.c", "vos_dtx.c", "vos_query.c", "vos_overhead.c", "vos_dtx_iter.c", "vos_gc.c", "vos_ilog.c", "ilog.c", "vos_ts.c", "lru_array.c", "vos_space.c", "sys_db.c", - "vos_csum_recalc.c", "vos_pool_scrub.c"] + "vos_csum_recalc.c", "vos_pool_scrub.c", "pmdk_log.c"] def build_vos(env, standalone): diff --git a/src/vos/pmdk_log.c b/src/vos/pmdk_log.c new file mode 100644 index 00000000000..7c607ba6b5e --- /dev/null +++ b/src/vos/pmdk_log.c @@ -0,0 +1,92 @@ +/** + * (C) Copyright 2024 Intel Corporation. + * (C) Copyright 2025 Google LLC + * (C) Copyright 2025 Hewlett Packard Enterprise Development LP + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + */ +/** + * Connecting the PMDK's logging to DAOS logging. + * + * vos/pmdk_log.c + */ + +#define D_LOGFAC DD_FAC(pmdk) + +#ifdef DAOS_PMEM_BUILD +#include +#include +#include +#include + +#define PMDK_LOG_2_DAOS_LOG_INIT(PMDK_LEVEL, DAOS_LEVEL) \ + [PMDK_LEVEL] = {.level = DAOS_LEVEL, .saved_mask = &DD_FLAG(DAOS_LEVEL, D_LOGFAC)} + +static struct { + int level; + int *saved_mask; +} pmemobj_log_level_2_daos_log[] = { + PMDK_LOG_2_DAOS_LOG_INIT(PMEMOBJ_LOG_LEVEL_HARK, DLOG_INFO), + PMDK_LOG_2_DAOS_LOG_INIT(PMEMOBJ_LOG_LEVEL_FATAL, DLOG_CRIT), + PMDK_LOG_2_DAOS_LOG_INIT(PMEMOBJ_LOG_LEVEL_ERROR, DLOG_ERR), + PMDK_LOG_2_DAOS_LOG_INIT(PMEMOBJ_LOG_LEVEL_WARNING, DLOG_WARN), + PMDK_LOG_2_DAOS_LOG_INIT(PMEMOBJ_LOG_LEVEL_NOTICE, DLOG_NOTE), + PMDK_LOG_2_DAOS_LOG_INIT(PMEMOBJ_LOG_LEVEL_INFO, DLOG_INFO), + PMDK_LOG_2_DAOS_LOG_INIT(PMEMOBJ_LOG_LEVEL_DEBUG, DLOG_DBG), +}; + +#undef PMDK_LOG_2_DAOS_LOG_INIT + +static void +pmdk_log_function(enum pmemobj_log_level level, const char *file_name, unsigned line_no, + const char *function_name, const char *message) +{ +/* + * There is a set of handy macros for each of the message priorities + * that are used normally to report a message. They can't be used here + * directly since the file name, line number and the function name + * are provided via arguments to this callback function instead of + * via macro definitions (__FILE__, __LINE__, and __func__) as + * _D_LOG_NOCHECK() would like to consume them. So, the message here is + * provided a few macro-calls later via _D_DEBUG_W_SAVED_MASK() macro which allows + * to swap the _D_LOG_NOCHECK macro for a custom macro. + * + * D_ERROR(...) -> D_DEBUG(DLOG_ERR, ...) -> + * _D_DEBUG(_D_LOG_NOCHECK, DLOG_ERR, ...) -> + * _D_DEBUG_W_SAVED_MASK(_D_LOG_NOCHECK, DD_FLAG(DLOG_ERR, D_LOGFAC), DLOG_ERR, ...) + */ + +/* + * A custom variant of _D_LOG_NOCHECK() which passes the file name, + * line number and the function name from the local variables. + */ +#define PMDK_LOG_NOCHECK(mask, fmt, ...) \ + d_log(mask, "%s:%d %s() " fmt, file_name, line_no, function_name, ##__VA_ARGS__) + + int *saved_mask = pmemobj_log_level_2_daos_log[level].saved_mask; + _D_DEBUG_W_SAVED_MASK(PMDK_LOG_NOCHECK, *saved_mask, + pmemobj_log_level_2_daos_log[level].level, "%s\n", message); + +#undef PMDK_LOG_NOCHECK +} + +int +pmdk_log_attach(void) +{ + int rc = pmemobj_log_set_function(pmdk_log_function); + if (rc == 0) { + return 0; + } else { + return daos_errno2der(errno); + } +} + +#else + +int +pmdk_log_attach(void) +{ + ; +} + +#endif /* DAOS_PMEM_BUILD */ diff --git a/src/vos/pmdk_log.h b/src/vos/pmdk_log.h new file mode 100644 index 00000000000..e2e1dfa93c8 --- /dev/null +++ b/src/vos/pmdk_log.h @@ -0,0 +1,18 @@ +/** + * (C) Copyright 2024 Intel Corporation. + * (C) Copyright 2025 Hewlett Packard Enterprise Development LP + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + */ +/** + * Connecting the PMDK's logging to DAOS logging. + * vos/pmdk_log.h + */ + +#ifndef __PMDK_LOG__ +#define __PMDK_LOG__ + +int +pmdk_log_attach(void); + +#endif /* __PMDK_LOG__ */ diff --git a/src/vos/vos_common.c b/src/vos/vos_common.c index 4713971d65c..7676f50afb1 100644 --- a/src/vos/vos_common.c +++ b/src/vos/vos_common.c @@ -24,6 +24,7 @@ #include #include #include "vos_internal.h" +#include "pmdk_log.h" struct vos_self_mode { struct vos_tls *self_tls; @@ -665,6 +666,12 @@ vos_mod_init(void) if (vos_start_epoch == DAOS_EPOCH_MAX) vos_start_epoch = d_hlc_get(); + rc = pmdk_log_attach(); + if (rc != 0) { + D_ERROR("PMDK log initialization error\n"); + return rc; + } + rc = vos_pool_settings_init(bio_nvme_configured(SMD_DEV_TYPE_META)); if (rc != 0) { D_ERROR("VOS pool setting initialization error\n"); diff --git a/utils/build.config b/utils/build.config index e90e4c8c7c6..692c5e44b6e 100644 --- a/utils/build.config +++ b/utils/build.config @@ -28,5 +28,5 @@ ucx=https://github.com/openucx/ucx.git [patch_versions] spdk=https://github.com/spdk/spdk/commit/b0aba3fcd5aceceea530a702922153bc75664978.diff,https://github.com/spdk/spdk/commit/445a4c808badbad3942696ecf16fa60e8129a747.diff mercury=https://raw.githubusercontent.com/daos-stack/mercury/f3dc286fb40ec1a3a38a2e17c45497bc2aa6290d/na_ucx.patch,https://raw.githubusercontent.com/daos-stack/mercury/48df263212604336b2dbe0430dcab4482eb43437/na_ucx_ep_flush.patch -pmdk=https://github.com/pmem/pmdk/commit/2abe15ac0b4eed894b6768cd82a3b0a7c4336284.diff +pmdk=https://github.com/pmem/pmdk/commit/2abe15ac0b4eed894b6768cd82a3b0a7c4336284.patch,https://github.com/pmem/pmdk/commit/61e32285370e629e2b36bbb991b919e44f87d915.patch,https://github.com/pmem/pmdk/commit/518b7426a13b21f98b2d2c435fa645770899446a.patch argobots=https://github.com/pmodels/argobots/pull/397/commits/411e5b344642ebc82190fd8b125db512e5b449d1.diff,https://github.com/pmodels/argobots/commit/bb0c908abfac4bfe37852eee621930634183c6aa.diff diff --git a/utils/rpms/daos.spec b/utils/rpms/daos.spec index ec793fc5dcc..a792e0cb3f2 100644 --- a/utils/rpms/daos.spec +++ b/utils/rpms/daos.spec @@ -16,7 +16,7 @@ Name: daos Version: 2.7.101 -Release: 4%{?relval}%{?dist} +Release: 5%{?relval}%{?dist} Summary: DAOS Storage Engine License: BSD-2-Clause-Patent @@ -592,6 +592,9 @@ getent passwd daos_agent >/dev/null || useradd -s /sbin/nologin -r -g daos_agent # No files in a shim package %changelog +* Tue Jan 14 2025 Tomasz Gromadzki 2.7.101-5 +- pmemobj errors and warnings reported via DAOS logging system + * Fri Dec 20 2024 Jeff Olivier 2.7.101-4 - Switch libfuse3 to libfused