From 093316a897a2eb4972a7a3a5888f40975d03f6bf Mon Sep 17 00:00:00 2001 From: Brice Goglin Date: Tue, 5 Apr 2022 17:39:50 +0200 Subject: [PATCH] linux: (partial) fix the discovery of hugepages on btrfs fsroot btrfs always returns 1 in directory stat.st_nlink. It breaks make check in tests/linux/ because the hugepages discovery uses st_nlink to allocate the memory page_types array. Always allocate at least 3 page_types slots (enough for all known cases, 1 for normal, 2 for huge pages) (partially cherry-picked from commit 7f351cec9bfe54a031f35ad16c9cfb99784d76dc) We don't reallocate later if needed as in 2.x commit 7f351cec9bfe54a031f35ad16c9cfb99784d76dc because v1.11 doesn't deserve a complete fix. Just commit the minimal change so that tests/linux/2i386-2t-hugepagesizecount with HWLOC_PAGESIZE_DEBUG=4096 doesn't crash in btrfs anymore (test-topology.sh fails during make check if /tmp is in btrfs). Thanks to Philippe Swartvagher for the report. Signed-off-by: Brice Goglin --- src/topology-linux.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/topology-linux.c b/src/topology-linux.c index 58c275fea..269eca7f5 100644 --- a/src/topology-linux.c +++ b/src/topology-linux.c @@ -1,6 +1,6 @@ /* * Copyright © 2009 CNRS - * Copyright © 2009-2019 Inria. All rights reserved. + * Copyright © 2009-2022 Inria. All rights reserved. * Copyright © 2009-2013, 2015 Université Bordeaux * Copyright © 2009-2014 Cisco Systems, Inc. All rights reserved. * Copyright © 2015 Intel, Inc. All rights reserved. @@ -2329,7 +2329,14 @@ hwloc_get_procfs_meminfo_info(struct hwloc_topology *topology, err = hwloc_stat("/sys/kernel/mm/hugepages", &st, data->root_fd); if (!err) { - types = 1 + st.st_nlink-2; + types = 1 /* normal non-huge size */ + st.st_nlink - 2 /* ignore . and .. */; + if (types < 3) + /* some buggy filesystems (e.g. btrfs when reading from fsroot) + * return wrong st_nlink for directories (always 1 for btrfs). + * use 3 as a sane default (default page + 2 huge sizes). + * hwloc_parse_hugepages_info() will extend it if needed. + */ + types = 3; has_sysfs_hugepages = 1; } > ix/log/gnu/tests/base.scm?id=6f7778e5da7e9a655109ca4cf021e7507f44e7d3'>base.scm
AgeCommit message (Expand)Author
2024-10-24gnu: system: Privilege programs after creating accounts....Ensure that users and groups are already created when the privileging script runs. The order these scripts appear in the folded activation-service depends on the order these services are instantiated in the operating-system. Fixes <https://issues.guix.gnu.org/73680>. * gnu/system.scm (operating-system-default-essential-services): Move privileged-program-service above account-service. (hurd-default-essential-services): Likewise. * gnu/tests/base.scm (%activation-os): New variable. (run-activation-test): New procedure. (%test-activation): New variable. Change-Id: I59a191c5519475f256e81bdf2dc4cb01b96c31fe Signed-off-by: Ludovic Courtès <ludo@gnu.org> Dariqq
2024-09-25services: cleanup: Reintroduce explicit ‘chmod’ calls....This reverts commit e74d05db53fdf02956ccee0950896c6ca9f10573. * gnu/services.scm (cleanup-gexp): Introduce explicit ‘chmod’ calls after ‘mkdir’ calls. * gnu/tests/base.scm (run-basic-test)[test]("permissions on /tmp"): New test. Reported-by: Hilton Chain <hako@ultrarare.space> Change-Id: I1e14dbe52eac526d2ed4ec1dd9c6fd9036f96a63 Ludovic Courtès
2024-07-18tests: base: Compare all the service provisions, not just canonical names....* gnu/tests/base.scm (run-basic-test)["shepherd services"]: Use ‘append-map’ on live service provisions to match what ‘operating-system-shepherd-service-names’ does. Change-Id: Ie54082eed6c7b8d37d3428711e71c11e80940235 Ludovic Courtès