[CRIU] [PATCH 04/11] mount: don't set m->bind if m is already mounted

Andrew Vagin avagin at parallels.com
Tue Aug 5 05:55:10 PDT 2014


On Tue, Aug 05, 2014 at 04:36:44PM +0400, Pavel Emelyanov wrote:
> On 08/03/2014 10:31 PM, Andrey Vagin wrote:
> > m->bind will be used to get the lowest mount.
> > 
> > mount is "lowest", if m->bind is NULL. The "lowest" moutn is mounted, all
> > other are bind-mounted from it.
> 
> How can this happen? I mean -- how can a mount be mounted before we get
> into the calls you patch?

propagate_siblings() is called for each mount and it marks other mounts.
A part of these other mounts can be already mounted.

> 
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > ---
> >  mount.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/mount.c b/mount.c
> > index 80ed133..d1f1f78 100644
> > --- a/mount.c
> > +++ b/mount.c
> > @@ -1197,11 +1197,15 @@ 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)
> > +			continue;
> >  		pr_debug("\t\tBind %s\n", t->mountpoint);
> >  		t->bind = mi;
> >  	}
> >  
> >  	list_for_each_entry(t, &mi->mnt_slave_list, mnt_slave) {
> > +		if (t->mounted)
> > +			continue;
> >  		pr_debug("\t\tBind %s\n", t->mountpoint);
> >  		t->bind = mi;
> >  	}
> > @@ -1242,6 +1246,8 @@ skip_parent:
> >  	 */
> >  	if (fsroot_mounted(mi) || mi->parent == NULL)
> >  		list_for_each_entry(t, &mi->mnt_bind, mnt_bind) {
> > +			if (t->mounted)
> > +				continue;
> >  			if (t->bind)
> >  				continue;
> >  			if (t->master_id)
> > 
> 


More information about the CRIU mailing list