[CRIU] [PATCH] irmap: add --irmap-scan-path option

Tycho Andersen tycho.andersen at canonical.com
Mon Sep 21 06:59:03 PDT 2015


On Mon, Sep 21, 2015 at 11:47:16AM +0300, Pavel Emelyanov wrote:
> On 09/16/2015 07:27 AM, Tycho Andersen wrote:
> > This option allows users to specify their own irmap paths to scan in the event
> > that they don't have a path in one of the hard coded hints.
> 
> Applied, thanks! One comment inline :) to be fixed on top.
> 
> > Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> 
> > @@ -260,6 +262,27 @@ char *irmap_lookup(unsigned int s_dev, unsigned long i_ino)
> >  		goto out;
> >  	}
> >  
> > +	/* Let's scan any user provided paths first; since the user told us
> > +	 * about them, hopefully they're more interesting than our hints.
> > +	 */
> > +	list_for_each_entry(o, &opts.irmap_scan_paths, node) {
> > +		struct irmap *ir;
> > +
> > +		ir = xzalloc(sizeof(*ir));
> > +		if (!ir)
> > +			goto out;
> > +
> > +		ir->nr_kids = -1;
> > +		ir->path = o->path;
> > +
> > +		c = irmap_scan(ir, s_dev, i_ino);
> > +		if (c) {
> > +			pr_debug("\tScanned %s\n", c->path);
> > +			path = c->path;
> > +			goto out;
> > +		}
> 
> Here we leak the ir object. Any additional call to irmal_resolve will add more and
> more of them.

Whoops, thanks. Leaking was intentional, because it looked to me like
the cache pointed to that. But yes, we should only ever add one. I'll
send a fix shortly.

Tycho

> > +	}
> > +
> >  	for (h = hints; h->path; h++) {
> >  		pr_debug("Scanning %s hint\n", h->path);
> >  		c = irmap_scan(h, s_dev, i_ino);
> 


More information about the CRIU mailing list