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 <[email protected]>
---
 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
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to