From: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
To: khorenko@virtuozzo.com, vladimir.riabchun@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.2] selftests/ve: read ve.mnt_avail_nr as a signed value in ve_ns_owner_test
Date: Thu, 19 Nov 2026 11:12:23 +0400 [thread overview]
Message-ID: <20261119071250.470335-1-mirian.shilakadze@virtuozzo.com> (raw)
The new VE is charged for every mount it copies from the host, and that
charge ignores the limit, so ve.mnt_avail_nr goes below zero once the
host has more mounts than the test's limit of 32. A VHI host with 70
mounts reads -39. The test reads the counter with read_u64_at(), the
negative value wraps to a huge number and both cases fail the check
that it is less than VE_MOUNTS_MAX.
Read the counter with read_s32_at(), as ve_mount_accounting_test does.
Fixes: 5eed1403cd54 ("ve: make mount limit configurable per VE")
Feature: per-ve failcounters
https://virtuozzo.atlassian.net/browse/VSTOR-156012
Signed-off-by: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
---
Tested on vz10 kernel 6.12.0-211.75.1.26.2 in a VM with 40 mounts:
both ve_ns_owner cases fail without the patch and pass with it, the
rest of the ve selftests give the same results.
tools/testing/selftests/ve/ve_ns_owner_test.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/ve/ve_ns_owner_test.c b/tools/testing/selftests/ve/ve_ns_owner_test.c
index dcff4d54172d..e02ad87dd41a 100644
--- a/tools/testing/selftests/ve/ve_ns_owner_test.c
+++ b/tools/testing/selftests/ve/ve_ns_owner_test.c
@@ -118,15 +118,17 @@ static int clone_child_func(void *arg)
static void check_new_ve_owner(struct __test_metadata *_metadata,
int cgv2_fd, int ctid)
{
- unsigned long long avail_netns, avail_mnt;
+ unsigned long long avail_netns;
char path[64];
+ int avail_mnt;
snprintf(path, sizeof(path), "%d/ve.netns_avail_nr", ctid);
ASSERT_EQ(read_u64_at(cgv2_fd, path, &avail_netns), 0);
EXPECT_EQ(avail_netns, VE_NETNS_MAX - 1);
+ /* Below zero when the host has more mounts than VE_MOUNTS_MAX. */
snprintf(path, sizeof(path), "%d/ve.mnt_avail_nr", ctid);
- ASSERT_EQ(read_u64_at(cgv2_fd, path, &avail_mnt), 0);
+ ASSERT_EQ(read_s32_at(cgv2_fd, path, &avail_mnt), 0);
EXPECT_LT(avail_mnt, VE_MOUNTS_MAX);
}
@@ -138,7 +140,7 @@ FIXTURE(ve_ns_owner)
FIXTURE_SETUP(ve_ns_owner)
{
- unsigned long long initial_mnt_avail_nr;
+ int initial_mnt_avail_nr;
char val[16];
char path[PATH_MAX];
@@ -184,7 +186,7 @@ FIXTURE_SETUP(ve_ns_owner)
* under this ve, i.e. mnt_avail_nr strictly decreases.
*/
snprintf(path, sizeof(path), "%d/ve.mnt_avail_nr", self->ctid);
- ASSERT_EQ(read_u64_at(self->cgv2_fd, path, &initial_mnt_avail_nr), 0);
+ ASSERT_EQ(read_s32_at(self->cgv2_fd, path, &initial_mnt_avail_nr), 0);
ASSERT_EQ(initial_mnt_avail_nr, VE_MOUNTS_MAX);
};
--
2.47.3
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next reply other threads:[~2026-11-19 7:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 7:12 Mirian Shilakadze [this message]
2026-11-19 7:15 ` no-reply
2026-11-19 16:51 ` Konstantin Khorenko
2026-11-19 16:52 ` 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=20261119071250.470335-1-mirian.shilakadze@virtuozzo.com \
--to=mirian.shilakadze@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@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.