[CRIU] [PATCH] namespace: mark mount namespaces as populated after the forking stage

Cyrill Gorcunov gorcunov at gmail.com
Wed Jun 15 05:02:02 PDT 2016


On Wed, Jun 15, 2016 at 02:46:52PM +0300, Pavel Emelyanov wrote:
...
> > @@ -3161,9 +3158,10 @@ void fini_restore_mntns(void)
> >  	for (nsid = ns_ids; nsid != NULL; nsid = nsid->next) {
> >  		if (nsid->nd != &mnt_ns_desc)
> >  			continue;
> > -		close(nsid->mnt.ns_fd);
> > +		close_safe(&nsid->mnt.ns_fd);
> 
> Why _safe()?

Can't comment the rest of questions, but can address this one:
it allows us better debuggin. When we've hit the problem the
@ns_fd pointed to descriptor 5, which has been already taken
by the rest of file engine, and we took a wrong way trying to
figure out the problem.

In turn, when we use close_safe here, it become -1 and of course
no longer points to anything valid.


More information about the CRIU mailing list