[CRIU] [PATCH 4/4] mount: handle old images where sb and mnt options were not separated (v3)
Andrey Vagin
avagin at openvz.org
Mon Sep 7 13:09:45 PDT 2015
Currently we have only one common flag. It is MS_READONLY and it's
interpreted as a super block flag to not change old behaviour.
v2: add a comment
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
mount.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/mount.c b/mount.c
index c08081f..0c14a4d 100644
--- a/mount.c
+++ b/mount.c
@@ -2378,6 +2378,20 @@ static int collect_mnt_from_image(struct mount_info **pms, struct ns_id *nsid)
pm->s_dev = me->root_dev;
pm->flags = me->flags;
pm->sb_flags = me->sb_flags;
+ if (!me->has_sb_flags) {
+ const unsigned int mflags = MS_SHARED | MS_PRIVATE |
+ MS_SLAVE | MS_UNBINDABLE |
+ MS_NOSUID | MS_NODEV | MS_NOEXEC |
+ MS_NOATIME | MS_NODIRATIME | MS_RELATIME;
+
+ /*
+ * In old images mnt and sb flags are saved together.
+ * Here we separate them and save the old logic about MS_RDONLY.
+ */
+
+ pm->sb_flags = pm->flags & ~mflags;
+ pm->flags = pm->flags & mflags;
+ }
pm->shared_id = me->shared_id;
pm->master_id = me->master_id;
pm->need_plugin = me->with_plugin;
--
2.4.3
More information about the CRIU
mailing list