[CRIU] Re: [PATCH 10/10] files: Use sys_kcmp to find file descriptor duplicates

Cyrill Gorcunov gorcunov at openvz.org
Mon Feb 27 09:01:41 EST 2012


On Mon, Feb 27, 2012 at 05:54:59PM +0400, Pavel Emelyanov wrote:
> >>> +
> >>> +       e = alloc_fd_id_entry(genid, pid, fd);
> >>> +       if (!e)
> >>> +               goto err;
> >>
> >> Here the subid will be INVALID. This is ... wrong.
> >>
> >>> +       rb_link_node(&e->node, parent, new);
> >>> +       rb_insert_color(&e->node, &fd_id_root);
> >>> +err:
> >>> +       return e;
> >>> +}
> >>> +
> > 
> > No, it's OK, the only _subsequent_ subid become a numbers from global
> > counter. Maybe I should simply rename FD_SUBID_INVALID to say FD_SUBID_FIRST
> > to eliminate confusion?
> 
> Yes, some better name is OK. I assume that just 0 will work too.

Yes, 0 will work as well but I would prefer to keep some predefined
value other than 0 which actually gives us a good hint in debugging
purpose.

> > Sure we can do so but it potentially may increase the number
> > of syscalls we need to yield if position is somewhere on top
> > 32 bits.
> 
> This doesn't matter. I can imagine quite a few real-life usecases
> when we have a container with plenty of files pointing to the
> same dev:ino pair. We can even throw the pos out and it will still
> work OK (remember, the sys_kcmp returns actual COMPARISON, not just
> equals/notequals).
> 
> > Pavel, while you at it -- the main problem is the fact itself
> > that we have two fields in image?
> 
> Yes. I want it to be just u64 ID and that's it.
> 

OK, will update.

	Cyrill


More information about the CRIU mailing list