Commit a4239104 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Pavel Emelyanov

mounts: Skip already bound siblings in propagate_siblings()

This function may be called several times for a mnt_share family.
The second call with a mi, which was not a bind source during the
first call, leads to double dependence:

a <-> b <-> c

1)propagate_siblings(a)

b->bind = a;
c->bind = a;

2)propagate_siblings(b)

c->bind = b;
(a is not set, because its mounted is 1).

So during c's bind mount criu use b's root and refers to a wrong
directory.

The reproduction: mntns_root_bind02 test.

The patch fixes the problem.
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Acked-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 076c73b2
...@@ -2118,7 +2118,7 @@ static int propagate_siblings(struct mount_info *mi) ...@@ -2118,7 +2118,7 @@ static int propagate_siblings(struct mount_info *mi)
* to inherite shared group or master id * to inherite shared group or master id
*/ */
list_for_each_entry(t, &mi->mnt_share, mnt_share) { list_for_each_entry(t, &mi->mnt_share, mnt_share) {
if (t->mounted) if (t->mounted || t->bind)
continue; continue;
pr_debug("\t\tBind share %s\n", t->mountpoint); pr_debug("\t\tBind share %s\n", t->mountpoint);
t->bind = mi; t->bind = mi;
...@@ -2126,7 +2126,7 @@ static int propagate_siblings(struct mount_info *mi) ...@@ -2126,7 +2126,7 @@ static int propagate_siblings(struct mount_info *mi)
} }
list_for_each_entry(t, &mi->mnt_slave_list, mnt_slave) { list_for_each_entry(t, &mi->mnt_slave_list, mnt_slave) {
if (t->mounted) if (t->mounted || t->bind)
continue; continue;
pr_debug("\t\tBind slave %s\n", t->mountpoint); pr_debug("\t\tBind slave %s\n", t->mountpoint);
t->bind = mi; t->bind = mi;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment