[CRIU] [PATCH 2/2] mount: support recursive bind mounts

Tycho Andersen tycho.andersen at canonical.com
Fri May 20 08:19:34 PDT 2016


On Fri, May 20, 2016 at 02:28:57PM +0300, Pavel Emelyanov wrote:
> On 05/17/2016 01:30 AM, Tycho Andersen wrote:
> > The inital mount() call for a bind mount needs to have the MS_REC flag
> > present if the bind mount is recursive.
> 
> Is it still needed after the latest version of tracefs patch?

Yes, it is; we need the MS_REC bit set on the first MS_BIND.

I'll send a patch for a test today, thanks!

Tycho

> > Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> > ---
> >  criu/mount.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/criu/mount.c b/criu/mount.c
> > index e85e5d9..30e7203 100644
> > --- a/criu/mount.c
> > +++ b/criu/mount.c
> > @@ -2586,7 +2586,7 @@ do_bind:
> >  		}
> >  	}
> >  
> > -	if (mount(root, mi->mountpoint, NULL, MS_BIND, NULL) < 0) {
> > +	if (mount(root, mi->mountpoint, NULL, MS_BIND | (mi->flags & MS_REC), NULL) < 0) {
> >  		pr_perror("Can't mount at %s", mi->mountpoint);
> >  		goto err;
> >  	}
> > 
> 


More information about the CRIU mailing list