[Devel] [PATCH VZ10 v5 9/9] selftests/ve: Add mount accounting selftest
Vasileios Almpanis
vasileios.almpanis at virtuozzo.com
Mon Aug 17 14:54:21 MSK 2026
On Sun, 02 Aug 2026 11:40:39 +0000, Vladimir Riabchun <vladimir.riabchun at virtuozzo.com> wrote:
> There are 6 test cases, covered in the new test:
> 1. Simple mount accouting correctness, just mount/umount.
> 2. Verification of correct limit hits and changes, including
> negative values.
> 3. Patial mounts test, when mount limit is hit in the middle
> of creation.
nit: Partial
> 4. Test that enabled pseudosuper allows overuse.
> 5. Test that pseudosuper doesn't affect mount accoutning.
nit: accounting
>
>
> diff --git a/tools/testing/selftests/ve/ve_mount_accounting_test.c b/tools/testing/selftests/ve/ve_mount_accounting_test.c
> new file mode 100644
> index 000000000000..b295290ec6e8
> --- /dev/null
> +++ b/tools/testing/selftests/ve/ve_mount_accounting_test.c
> @@ -0,0 +1,419 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * ve_mount_accounting selftests
> + *
> + * Tests to check the correctness of mount accounting.
> + */
> +#define _GNU_SOURCE
> +#include <linux/sched.h>
> +#include <linux/mount.h>
Is linux/mount needed here? You include both linux/mount and sys/mount.
You only call mount,umount so dropping it looks generally safe.
> [ ... skip 181 lines ... ]
> + ASSERT_EQ(read_u64_at(self->cgv2_fd, path, &initial_mnt_avail_nr), 0);
> + ASSERT_EQ(initial_mnt_avail_nr, VE_MOUNTS_MAX);
> +};
> +
> +FIXTURE_TEARDOWN(ve_mnt_acc)
> +{
Since we mount tmpfs on host mount namespace (we dont pass CLONE_NEWNS),
should we iterate here and umount all the ids that remain mounted after
tests bail? There are maybe places where create_mount is tried and if
assertion fails the mount remains and leaks to the host possibly also
pinning the ve namespace since in ve_try_reserve_mount we get a refcount
on it.
--
Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>
More information about the Devel
mailing list