Commit 1c2b1633 authored by Pavel Emelyanov's avatar Pavel Emelyanov

mount: Check for mount postponing with a helper

The expression in if () becomes quite complex and
deserves a helper with proper explanation of what's
going on.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 08b893fd
...@@ -1134,6 +1134,25 @@ static int do_bind_mount(struct mount_info *mi) ...@@ -1134,6 +1134,25 @@ static int do_bind_mount(struct mount_info *mi)
return 0; return 0;
} }
static bool can_mount_now(struct mount_info *mi)
{
/*
* Private root mounts can be mounted at any time
*/
if (!mi->master_id && fsroot_mounted(mi))
return true;
/*
* Other mounts can be mounted only if they have
* the master mount (see propagate_mount) or if we
* expect a plugin to help us.
*/
if (mi->bind || mi->need_plugin)
return true;
return false;
}
static int do_mount_one(struct mount_info *mi) static int do_mount_one(struct mount_info *mi)
{ {
int ret; int ret;
...@@ -1144,8 +1163,7 @@ static int do_mount_one(struct mount_info *mi) ...@@ -1144,8 +1163,7 @@ static int do_mount_one(struct mount_info *mi)
if (mi->mounted) if (mi->mounted)
return 0; return 0;
if ((mi->master_id || !fsroot_mounted(mi)) && if (!can_mount_now(mi)) {
(mi->bind == NULL && !mi->need_plugin)) {
pr_debug("Postpone slave %s\n", mi->mountpoint); pr_debug("Postpone slave %s\n", mi->mountpoint);
return 1; return 1;
} }
......
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