Commit 64c95bf5 authored by Pavel Emelyanov's avatar Pavel Emelyanov

mount: Add helper to search for widest shared peer

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Acked-by: 's avatarAndrew Vagin <avagin@parallels.com>
parent 1cf5168c
...@@ -373,6 +373,21 @@ static int try_resolve_ext_mount(struct mount_info *info) ...@@ -373,6 +373,21 @@ static int try_resolve_ext_mount(struct mount_info *info)
return 0; return 0;
} }
static struct mount_info *get_widest_peer(struct mount_info *m)
{
struct mount_info *p;
/*
* Try to find a mount, which is wider or equal.
* A is wider than B, if A->root is a subpath of B->root.
*/
list_for_each_entry(p, &m->mnt_share, mnt_share)
if (issubpath(m->root, p->root))
return p;
return NULL;
}
static int validate_shared(struct mount_info *m) static int validate_shared(struct mount_info *m)
{ {
struct mount_info *t, *ct, *cm, *tmp; struct mount_info *t, *ct, *cm, *tmp;
...@@ -391,19 +406,13 @@ static int validate_shared(struct mount_info *m) ...@@ -391,19 +406,13 @@ static int validate_shared(struct mount_info *m)
* has the same set of children. * has the same set of children.
*/ */
/* t = get_widest_peer(m);
* Try to find a mount, which is wider or equal. if (!t)
* A is wider than B, if A->root is a substring of B->root. /*
*/ * The current mount is the widest one in its shared group,
list_for_each_entry(t, &m->mnt_share, mnt_share) * all others will be compared to it or with some other,
if (issubpath(m->root, t->root)) * which will be compared to it.
break; */
/*
* The current mount is widest one in its shared group,
* all others should be compared with it.
*/
if (&t->mnt_share == &m->mnt_share)
return 0; return 0;
/* A set of childrent which ar visiable for both should be the same */ /* A set of childrent which ar visiable for both should be the same */
......
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