[CRIU] [PATCH 2/4] sfd: Rework install, clone helpers to use fcntl

Cyrill Gorcunov gorcunov at gmail.com
Tue May 30 15:14:08 PDT 2017


On Tue, May 30, 2017 at 02:47:55PM -0700, Andrey Vagin wrote:
> > +
> > +		/*
> > +		 * Cloning of service fds happen at early stage
> > +		 * where no other files needed are opened, so
> > +		 * for simplicity just close the destination.
> 
> Why should we close the destination? Who could open it?

Our fdt_shared test already does it :( There is a transition
from service_fd_id = 2 to 0, where 0 already has these
files opened. If you uncomment SDF_DEBUG on top of this
patch and run the test you'll see.

> 
> > +		 *
> > +		 * FIXME: Still better to invent more deep tracking
> > +		 * of service files opened, say every rsti(item)
> > +		 * structure should have own sfd_map and everything
> > +		 * should be under appropriate shared locking.
> > +		 */
> > +		close(new);
> 
> I don't understand why we need this close ^^^^
> 
> If it is need, why close + fcntl is better than dup2?

This is temp solution, see FIXME above. We need more deep
rework here, so sfd will be per id. At moment it's not
anyhow better then dup, but for _now_ only.


More information about the CRIU mailing list