[2/6] mnt: restore shared mounts in a correct shared group

Submitted by Andrei Vagin on Sept. 13, 2016, 4:19 a.m.

Details

Message ID 1473740388-3797-3-git-send-email-avagin@openvz.org
State Accepted
Series "mnt: try to split a mount tree to restore over-mounted mounts"
Commit 2c24b9c1b5472715da230652b9512e32a5e763e9
Headers show

Commit Message

Andrei Vagin Sept. 13, 2016, 4:19 a.m.
From: Andrei Vagin <avagin@virtuozzo.com>

Currently when we have a shared group, we set a source mount for all
of them and then we need to update a source mount when we mount a first
mount from a shared group, because a shared id can be only inherited.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
---
 criu/mount.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/criu/mount.c b/criu/mount.c
index 797edd7..1121ce0 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -2181,7 +2181,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 == t->shared_id)
 			continue;
 		pr_debug("\t\tBind share %s\n", t->mountpoint);
 		t->bind = mi;

Comments

Pavel Emelianov Sept. 21, 2016, 7:19 a.m.
On 09/13/2016 07:19 AM, Andrei Vagin wrote:
> From: Andrei Vagin <avagin@virtuozzo.com>
> 
> Currently when we have a shared group, we set a source mount for all
> of them and then we need to update a source mount when we mount a first
> mount from a shared group, because a shared id can be only inherited.

So is it a bugfix? Can we have a test for that?

> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
> ---
>  criu/mount.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/criu/mount.c b/criu/mount.c
> index 797edd7..1121ce0 100644
> --- a/criu/mount.c
> +++ b/criu/mount.c
> @@ -2181,7 +2181,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 == t->shared_id)
>  			continue;
>  		pr_debug("\t\tBind share %s\n", t->mountpoint);
>  		t->bind = mi;
>
Andrey Vagin Sept. 22, 2016, 7:40 p.m.
On Wed, Sep 21, 2016 at 10:19:56AM +0300, Pavel Emelyanov wrote:
> On 09/13/2016 07:19 AM, Andrei Vagin wrote:
> > From: Andrei Vagin <avagin@virtuozzo.com>
> > 
> > Currently when we have a shared group, we set a source mount for all
> > of them and then we need to update a source mount when we mount a first
> > mount from a shared group, because a shared id can be only inherited.
> 
> So is it a bugfix? Can we have a test for that?

The test from this series covers this case.

> 
> > Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
> > ---
> >  criu/mount.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/criu/mount.c b/criu/mount.c
> > index 797edd7..1121ce0 100644
> > --- a/criu/mount.c
> > +++ b/criu/mount.c
> > @@ -2181,7 +2181,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 == t->shared_id)
> >  			continue;
> >  		pr_debug("\t\tBind share %s\n", t->mountpoint);
> >  		t->bind = mi;
> > 
>