Commit 7db1e6b9 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

mount: don't set m->bind if m is already mounted

The m->bind will be used to get the "lowest" mount. A mount is
called "lowest" in the chain of bind-mounts when its m->bind is
NULL. I.e. -- it's the mount of the root dir of an FS, all the
others are bind-mounted from it.

The propagate_siblings() is called for each new mount and sets
the bind field for others. A part of these other mounts can be
already mounted.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent cf219f92
...@@ -1188,11 +1188,15 @@ static int propagate_siblings(struct mount_info *mi) ...@@ -1188,11 +1188,15 @@ 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)
continue;
pr_debug("\t\tBind %s\n", t->mountpoint); pr_debug("\t\tBind %s\n", t->mountpoint);
t->bind = mi; t->bind = 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)
continue;
pr_debug("\t\tBind %s\n", t->mountpoint); pr_debug("\t\tBind %s\n", t->mountpoint);
t->bind = mi; t->bind = mi;
} }
...@@ -1233,6 +1237,8 @@ skip_parent: ...@@ -1233,6 +1237,8 @@ skip_parent:
*/ */
if (fsroot_mounted(mi) || mi->parent == NULL) if (fsroot_mounted(mi) || mi->parent == NULL)
list_for_each_entry(t, &mi->mnt_bind, mnt_bind) { list_for_each_entry(t, &mi->mnt_bind, mnt_bind) {
if (t->mounted)
continue;
if (t->bind) if (t->bind)
continue; continue;
if (t->master_id) if (t->master_id)
......
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