[CRIU] [PATCH 1/7] irmap: use kdev everywere

Andrew Vagin avagin at virtuozzo.com
Wed Mar 9 08:42:22 PST 2016


On Wed, Mar 09, 2016 at 07:10:06PM +0300, Pavel Emelyanov wrote:
> On 03/09/2016 06:31 PM, Andrew Vagin wrote:
> > On Wed, Mar 09, 2016 at 03:11:21PM +0300, Pavel Emelyanov wrote:
> >> On 03/08/2016 09:43 PM, Andrey Vagin wrote:
> >>> From: Andrew Vagin <avagin at virtuozzo.com>
> >>>
> >>> Currently we kdev and odev together and try to compare them without
> >>> converting to the one type.
> >>
> >> Doesn't the removed kdev_to_odev() in the 3rd hunk do this?
> > 
> > No, it doesn't. There s_dev is kdev.
> 
> Hm.. Then the 3rd hunk looks wrong anyway. There's a check for c->dev == s_dev
> in irmap_lookup() below the removal which used to compare old device with converted
> old device. With this patch it starts comparing old device (c->dev) with
> new device.

fstatat() returns odev
but fdinfo for inotify contains kdev

We convert dev which we get from fstatat, which we use to contruct irmap
cache.

s_dev is a inotify device which we get from fdinfo, so it's alread kdev
> 
> >>
> >>> Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
> >>> ---
> >>>  criu/irmap.c | 6 ++----
> >>>  1 file changed, 2 insertions(+), 4 deletions(-)
> >>>
> >>> diff --git a/criu/irmap.c b/criu/irmap.c
> >>> index 1501887..c93a995 100644
> >>> --- a/criu/irmap.c
> >>> +++ b/criu/irmap.c
> >>> @@ -88,7 +88,7 @@ static int irmap_update_stat(struct irmap *i)
> >>>  	}
> >>>  
> >>>  	i->revalidate = false;
> >>> -	i->dev = st.st_dev;
> >>> +	i->dev = MKKDEV(major(st.st_dev), minor(st.st_dev));
> >>>  	i->ino = st.st_ino;
> >>>  	if (!S_ISDIR(st.st_mode))
> >>>  		i->nr_kids = 0; /* don't irmap_update_dir */
> >>> @@ -203,7 +203,7 @@ static int irmap_revalidate(struct irmap *c, struct irmap **p)
> >>>  		goto invalid;
> >>>  	}
> >>>  
> >>> -	if (c->dev != st.st_dev)
> >>> +	if (c->dev != MKKDEV(major(st.st_dev), minor(st.st_dev)))
> >>>  		goto invalid;
> >>>  	if (c->ino != st.st_ino)
> >>>  		goto invalid;
> >>> @@ -228,8 +228,6 @@ char *irmap_lookup(unsigned int s_dev, unsigned long i_ino)
> >>>  	int hv;
> >>>  	struct irmap_path_opt *o;
> >>>  
> >>> -	s_dev = kdev_to_odev(s_dev);
> >>> -
> >>>  	pr_debug("Resolving %x:%lx path\n", s_dev, i_ino);
> >>>  
> >>>  	/*
> >>>
> >>
> > .
> > 
> 


More information about the CRIU mailing list