[CRIU] [PATCH 06/14] mount: __lookup_mnt_id returns the first mi if mnt_id == -1

Andrew Vagin avagin at parallels.com
Fri Apr 18 02:18:24 PDT 2014


On Fri, Apr 18, 2014 at 12:38:09PM +0400, Pavel Emelyanov wrote:
> On 04/17/2014 11:24 PM, Andrey Vagin wrote:
> > Kernels before 3.15 doesn't show mnt_id in /proc/PID/fdinfo/X.
> > When processes are restored in a current mntns, we have only one root,
> > so here isn't matter which mount will be returned.
> > 
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > ---
> >  mount.c | 11 ++++++++++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> > 
> > diff --git a/mount.c b/mount.c
> > index dce69dc..da4ba47 100644
> > --- a/mount.c
> > +++ b/mount.c
> > @@ -110,9 +110,18 @@ static struct mount_info *__lookup_mnt_id(struct mount_info *list, int id)
> >  {
> >  	struct mount_info *m;
> >  
> > -	for (m = list; m != NULL; m = m->next)
> > +	for (m = list; m != NULL; m = m->next) {
> > +		/*
> > +		 * Kernel before 3.15 doesn't show mnt_id for file descriptors.
> > +		 * mnt_id isn't saved for files, if mntns isn't dumped.
> > +		 * In both these cases we have only one root, so here
> > +		 * is not matter which mount will be restured.
> > +		 */
> > +		if (id == -1)
> > +			return m;
> 
> O_O  but it's potentially the WRONG mount!

-_- I think we need to create a function for collecting root by mnt_id.

> 
> >  		if (m->mnt_id == id)
> >  			return m;
> > +	}
> >  
> >  	return NULL;
> >  }
> > 
> 
> 


More information about the CRIU mailing list