From: no-reply@sashiko.virtuozzo.com
To: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>,
khorenko@virtuozzo.com, vladimir.riabchun@virtuozzo.com
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.2 v2 1/3] selftests/ve: open the host cgroup2 mount instead of creating one
Date: Thu, 19 Nov 2026 08:21:50 +0000 [thread overview]
Message-ID: <010701a1f2e5d324-1da8b6cd-ec73-4818-bdf5-5f02ecde891e-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261119081654.484107-2-mirian.shilakadze@virtuozzo.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] selftests/ve: open_cg2_fd() fails instead of skipping without
cgroup2 at /sys/fs/cgroup
- [Low] selftests/ve: Fixes tag names refactor 2f614e4b0e5c, not the
commit that added the mount
--
commit 9abf088913d8283815643e8a2c0680ba8c91d1a5
Author: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
> selftests/ve: open the host cgroup2 mount instead of creating one
>
> mount_cg2_fd() gave the tests their cgroup2 fd by creating a fresh mount
> with fsopen(), fsconfig() and fsmount(), with no options. That ends in
> cgroup_get_tree(), which calls apply_cgroup_root_flags() with the new
> mount's options once the tree is built. For a caller in the root cgroup
> namespace that function does not only set the flags the new mount asked
> for, it also clears on cgrp_dfl_root the nsdelegate,
> memory_recursiveprot and other root options the new mount did not carry,
> and cgrp_dfl_root is the one hierarchy behind every cgroup2 mount on the
> host. So every fixture setup switched nsdelegate and
> memory_recursiveprot off on the host /sys/fs/cgroup until something
> remounted it. A node the ve tests had run on shows its cgroup2 mount
> without either option, three untouched nodes of the same image still
> show both.
>
> Open the existing mount instead. open_cg2_fd() opens /sys/fs/cgroup as a
> directory fd and checks with fstatfs() that it is cgroup2. The *at()
> calls the tests make work on that fd as they did on the fsmount fd, and
> nothing is mounted, so the host flags stay as systemd set them. The
> tests now need the host cgroup2 mount at /sys/fs/cgroup, which every
> vz10 host has. Every caller switches to it, and the messages that said
> "mount" now say "open". The header also no longer needs the glibc 2.36
> mount API wrappers.
>
> Fixes: 2f614e4b0e5c ("selftests/ve: factor common helpers into ve_selftest.h")
> Feature: fix selftests
> https://virtuozzo.atlassian.net/browse/VSTOR-139515
> Signed-off-by: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
[Severity: Low]
Does this Fixes: tag name the commit that introduced the problem? Commit
2f614e4b0e5c ("selftests/ve: factor common helpers into ve_selftest.h")
only moved the helper. Before it, ve_ns_owner_test.c already had a private
mount_cg2_fd() doing fsopen(), FSCONFIG_CMD_CREATE and fsmount() with no
options. That behaviour comes from 26ab97f91b8c ("selftests/ve: regression
test for CLONE_NEWVE owner correctness"). The other tests picked up the
behaviour through their own introducing commits, so no single commit covers
all of them. Could the commit message cite 26ab97f91b8c, or explain why the
refactor commit was chosen?
> diff --git a/tools/testing/selftests/ve/ve_aio_ring_test.c b/tools/testing/selftests/ve/ve_aio_ring_test.c
> index 1922a05aceef..c5b90427bdb3 100644
> --- a/tools/testing/selftests/ve/ve_aio_ring_test.c
> +++ b/tools/testing/selftests/ve/ve_aio_ring_test.c
> @@ -152,7 +152,7 @@ FIXTURE_SETUP(ve_aio_ring)
> MAP_SHARED | MAP_ANONYMOUS, -1, 0);
> ASSERT_NE(self->arg, MAP_FAILED);
>
> - self->cgv2_fd = mount_cg2_fd();
> + self->cgv2_fd = open_cg2_fd();
> ASSERT_GE(self->cgv2_fd, 0);
[Severity: Low]
Should this skip instead of fail when /sys/fs/cgroup is missing or is not
cgroup2? open_cg2_fd() returns -1 with ENOENT or ENODEV in that case (for
example a cgroup1 or hybrid layout, or a different mount namespace), and
this ASSERT_GE reports a test failure. The old fsopen() path did not depend
on where userspace mounted cgroup2. Kselftest policy treats a missing
prerequisite as a skip with a reason. Only ve_vtty_stress and
ve_numa_migrate turn the failure into a skip. The aio_ring, ns_owner,
perms, mount_accounting, numa_syscalls, tmpfs_mpol and cpuid_override
fixtures all assert.
[ ... ]
> diff --git a/tools/testing/selftests/ve/ve_selftest.h b/tools/testing/selftests/ve/ve_selftest.h
> --- a/tools/testing/selftests/ve/ve_selftest.h
> +++ b/tools/testing/selftests/ve/ve_selftest.h
> @@ -245,23 +246,26 @@ static inline int read_s32_at(int dirfd, const char *path,
> +static inline int open_cg2_fd(void)
> {
> + struct statfs st;
> + int fd;
>
> + fd = open("/sys/fs/cgroup", O_RDONLY | O_DIRECTORY | O_CLOEXEC);
> if (fd < 0)
> return -1;
> + if (fstatfs(fd, &st) < 0 || st.f_type != CGROUP2_SUPER_MAGIC) {
> + close(fd);
> + errno = ENODEV;
> return -1;
> }
> + return fd;
> }
[Severity: Low]
This is the helper behind the previous comment. Would returning a distinct
error, or having callers map ENOENT and ENODEV to SKIP with a reason such
as "no cgroup2 mount at /sys/fs/cgroup", keep the fixtures from failing
on hosts without that mount?
Carry the trailer below into the next revision and Sashiko will not review this patch again.
Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261119081654.484107-2-mirian.shilakadze@virtuozzo.com?part=1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-19 8:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 8:16 [Devel] [PATCH hci-8.2 v2 0/3] selftests/ve: move ve_devcg_bpf and ve_printk into ve/ Mirian Shilakadze
2026-11-19 8:16 ` [Devel] [PATCH hci-8.2 v2 1/3] selftests/ve: open the host cgroup2 mount instead of creating one Mirian Shilakadze
2026-11-19 8:21 ` no-reply [this message]
2026-11-19 17:00 ` Konstantin Khorenko
2026-11-19 8:16 ` [Devel] [PATCH hci-8.2 v2 2/3] selftests/ve: move ve_devcg_bpf into ve/ and reuse ve_selftest.h Mirian Shilakadze
2026-11-19 8:20 ` no-reply
2026-11-19 17:00 ` Konstantin Khorenko
2026-11-19 8:16 ` [Devel] [PATCH hci-8.2 v2 3/3] selftests/ve: move ve_printk " Mirian Shilakadze
2026-11-19 8:22 ` no-reply
2026-11-19 17:00 ` Konstantin Khorenko
2026-11-19 17:00 ` [Devel] [PATCH hci-8.2 v2 0/3] selftests/ve: move ve_devcg_bpf and ve_printk into ve/ Konstantin Khorenko
2026-11-19 17:01 ` Konstantin Khorenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=010701a1f2e5d324-1da8b6cd-ec73-4818-bdf5-5f02ecde891e-000000@eu-central-1.amazonses.com \
--to=no-reply@sashiko.virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
--cc=mirian.shilakadze@virtuozzo.com \
--cc=vladimir.riabchun@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.