[Devel] [PATCH vz10 v2 3/3] selftests/ve: test locking a mount from the host

Konstantin Khorenko khorenko at virtuozzo.com
Mon Nov 16 20:13:33 MSK 2026


I won't apply this version, please send v3 with the changes below.

On Mon, 16 Nov 2026 10:12:54 +0400, Mirian Shilakadze <mirian.shilakadze at virtuozzo.com> wrote:
> +TEST_F(lock, not_recursive)
> +{
> +	ASSERT_EQ(0, mount(SRC, DST, NULL, MS_BIND, NULL));
> +	ASSERT_EQ(-1, setattr(AT_FDCWD, DST, AT_RECURSIVE,
> +			      MOUNT_ATTR_VE_LOCK, 0));
> +	EXPECT_EQ(EINVAL, errno);
> +}

Items 1-3 of the cover letter reply:

- Lock DST without AT_RECURSIVE first and expect 0.
- Skip when not root, without user namespaces, or when the kernel
  lacks the lock bits.
- Check that statmount() reports the locks lock_mnt_tree() raised.

A kernel without the feature fails this test with EINVAL too, the
unknown bits are refused before AT_RECURSIVE is looked at. That is one
of the two tests the cover letter counts as passing on the stock
kernel.

FIXTURE_SETUP(lock) only asserts, so a run without root fails in
unshare(CLONE_NEWNS), and in_ct() turns a missing user namespace or
missing feature into a failure. The sibling ve tests SKIP when
geteuid() is not 0.

Patch 2 says statmount() reports kernel-raised locks as well; a mount
copied into a new user and mount namespace shows them, and no test
looks at it.

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team



More information about the Devel mailing list