OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
To: khorenko@virtuozzo.com, ptikhomirov@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH vz10 v2 2/3] fs: report the locks of a mount in statmount()
Date: Mon, 16 Nov 2026 10:12:53 +0400	[thread overview]
Message-ID: <20261116061256.54472-3-mirian.shilakadze@virtuozzo.com> (raw)
In-Reply-To: <20261116061256.54472-1-mirian.shilakadze@virtuozzo.com>

The locks a mount carries cannot be read back, so criu cannot dump them
and a restored container gets its mounts back unlocked.

Report them in the mnt_attr of statmount(), as the MOUNT_ATTR_VE_LOCK_*
attributes that raise them, whether the host raised them or the kernel
did, as lock_mnt_tree() does on a mount copied across user namespaces.
MNT_LOCK_ATIME has no such attribute and is not reported.

Feature: ve: ve generic structures
https://virtuozzo.atlassian.net/browse/VSTOR-155305
Signed-off-by: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
---
 fs/namespace.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/fs/namespace.c b/fs/namespace.c
index fa3c1851b7da..b73caff6a671 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -5431,6 +5431,15 @@ static u64 mnt_to_attr_flags(struct vfsmount *mnt)
 	if (is_idmapped_mnt(mnt))
 		attr_flags |= MOUNT_ATTR_IDMAP;
 
+	if (mnt_flags & MNT_LOCK_READONLY)
+		attr_flags |= MOUNT_ATTR_VE_LOCK_RDONLY;
+	if (mnt_flags & MNT_LOCK_NOSUID)
+		attr_flags |= MOUNT_ATTR_VE_LOCK_NOSUID;
+	if (mnt_flags & MNT_LOCK_NODEV)
+		attr_flags |= MOUNT_ATTR_VE_LOCK_NODEV;
+	if (mnt_flags & MNT_LOCK_NOEXEC)
+		attr_flags |= MOUNT_ATTR_VE_LOCK_NOEXEC;
+
 	return attr_flags;
 }
 
-- 
2.43.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  parent reply	other threads:[~2026-11-16  6:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  6:12 [Devel] [PATCH vz10 v2 0/3] fs: let the host lock the protection flags of a mount Mirian Shilakadze
2026-11-16  6:12 ` [Devel] [PATCH vz10 v2 1/3] fs: let the protection flags of a mount be locked from userspace Mirian Shilakadze
2026-11-16  6:24   ` no-reply
2026-11-16 17:13   ` Konstantin Khorenko
2026-11-16  6:12 ` Mirian Shilakadze [this message]
2026-11-16  6:17   ` [Devel] [PATCH vz10 v2 2/3] fs: report the locks of a mount in statmount() no-reply
2026-11-16 17:13   ` Konstantin Khorenko
2026-11-16  6:12 ` [Devel] [PATCH vz10 v2 3/3] selftests/ve: test locking a mount from the host Mirian Shilakadze
2026-11-16  6:38   ` no-reply
2026-11-16 17:13   ` Konstantin Khorenko
2026-11-16 17:13 ` [Devel] [PATCH vz10 v2 0/3] fs: let the host lock the protection flags of a mount 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=20261116061256.54472-3-mirian.shilakadze@virtuozzo.com \
    --to=mirian.shilakadze@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.com \
    --cc=ptikhomirov@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox