[CRIU] [PATCH 1/2] mnt: do_new_mount should restore sharing

Tycho Andersen tycho.andersen at canonical.com
Thu Apr 16 10:22:35 PDT 2015


On Thu, Apr 16, 2015 at 06:58:34PM +0200, Oleg Nesterov wrote:
> On 04/15, Tycho Andersen wrote:
> >
> > The function masks off sharing in the initial setting, but doesn't correctly
> > reset the flags afterwards.
> 
> Yes.
> 
> > --- a/mount.c
> > +++ b/mount.c
> > @@ -1789,7 +1789,9 @@ static int do_new_mount(struct mount_info *mi)
> >  		return -1;
> >  	}
> >
> > -	if (restore_shared_options(mi, 0, mi->shared_id, 0))
> > +	if (restore_shared_options(mi, !mi->shared_id && !mi->master_id,
> > +					mi->shared_id,
> > +					mi->master_id))
> 
> I can't review this change because of the lack of knowledge, although
> it looks corect to me, and at least this matches do_mount_root().
> 
> 
> But I'd like to ask the question... Shouldn't (or can't) we know these
> slave/shared/etc at dump time? IOW, can't restore_shared_options() rely
> more on mi->flags?
> 
> Say, can't we at least kill the "bool slave" argument and change it
> to check "mi->flags & MS_SLAVE" instead?

Yes, so I almost did that as a part of this patch. The problem is that
in some cases (internal_sharing, when a bind mount has different
sharing, than its source) we want to force a private remount before
doing a shared mount so we get different sharing IDs. We could add a
flag for just this case, though, and check mi->flags for everything
else, I just thought it was best to keep this patch small since it's a
known issue.

Tycho

> Just curious.
> 
> Oleg.
> 


More information about the CRIU mailing list