From: Andrei Vagin <ava...@openvz.org>

A widest mount of a shared group has to be mounted first and
then other mounts of this group has to be mounted from the first mount
to inherite the shared group.

https://jira.sw.ru/browse/PSBM-55494
Signed-off-by: Andrei Vagin <ava...@virtuozzo.com>
---
 criu/mount.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/criu/mount.c b/criu/mount.c
index 76d1505..3a98e63 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -2444,7 +2444,9 @@ static int propagate_siblings(struct mount_info *mi)
         * to inherite shared group or master id
         */
        list_for_each_entry(t, &mi->mnt_share, mnt_share) {
-               if (t->mounted || t->bind)
+               if (t->mounted)
+                       continue;
+               if (t->bind && t->bind->shared_id == mi->shared_id)
                        continue;
                pr_debug("\t\tBind share %s\n", t->mountpoint);
                t->bind = mi;
@@ -2902,6 +2904,15 @@ static bool can_mount_now(struct mount_info *mi)
        if (!fsroot_mounted(mi) && (mi->bind == NULL && !mi->need_plugin && 
!mi->external))
                return false;
 
+       if (mi->bind && mi->shared_id != mi->bind->shared_id) {
+               struct mount_info *n;
+               int len;
+
+               len = strlen(mi->root);
+               list_for_each_entry(n, &mi->mnt_share, mnt_share)
+                       if (len > strlen(n->root))
+                               return false;
+       }
 shared:
        if (mi->parent->shared_id) {
                struct mount_info *p = mi->parent, *n;
-- 
1.8.3.1

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

Reply via email to