All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
* [Devel] [PATCH hci-8.2] selftests/ve: read ve.mnt_avail_nr as a signed value in ve_ns_owner_test
@ 2026-11-19  7:12 Mirian Shilakadze
  2026-11-19  7:15 ` no-reply
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mirian Shilakadze @ 2026-11-19  7:12 UTC (permalink / raw)
  To: khorenko, vladimir.riabchun; +Cc: devel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-19 16:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19  7:12 [Devel] [PATCH hci-8.2] selftests/ve: read ve.mnt_avail_nr as a signed value in ve_ns_owner_test Mirian Shilakadze
2026-11-19  7:15 ` no-reply
2026-11-19 16:51 ` Konstantin Khorenko
2026-11-19 16:52 ` Konstantin Khorenko

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.