fd: Close caches proc-pid stuff before restoring files
fd: Close caches proc-pid stuff before restoring files

We have a bug. If someone opens proc with open_pid_proc or alike
with PROC_SELF of real PID before going to restore fds, then the
fd cached by proc helpers would be cached in fd 0 (we close all
fds beforehead) and it may clash with restored fds.

We don't hit this right now simply due to being too lucky -- we
call open_proc(PROC_GEN) on "locks" which first closes the cached
the per-pid descriptor and then reports back just the /proc one
which sits in service area.

But once we change this (next patch) things would get broken.

Signed-off-by: Pavel Emelyanov <c9a32589e048e044184536f7ac71ef92fe82df3e@parallels.com>

marcosnils/criu,ldu4/criu,LK4D4/criu,gablg1/criu,LK4D4/criu,LK4D4/criu,AuthenticEshkinKot/criu,fbocharov/criu,fbocharov/criu,ldu4/criu,eabatalov/criu,LK4D4/criu,gablg1/criu,gonkulator/criu,KKoukiou/criu-remote,rentzsch/criu,AuthenticEshkinKot/criu,gonkulator/criu,fbocharov/criu,sdgdsffdsfff/criu,sdgdsffdsfff/criu,AuthenticEshkinKot/criu,ldu4/criu,sdgdsffdsfff/criu,biddyweb/criu,tych0/criu,fbocharov/criu,wtf42/criu,biddyweb/criu,svloyso/criu,KKoukiou/criu-remote,marcosnils/criu,wtf42/criu,KKoukiou/criu-remote,svloyso/criu,marcosnils/criu,svloyso/criu,wtf42/criu,wtf42/criu,AuthenticEshkinKot/criu,efiop/criu,rentzsch/criu,marcosnils/criu,gablg1/criu,KKoukiou/criu-remote,AuthenticEshkinKot/criu,eabatalov/criu,tych0/criu,gablg1/criu,LK4D4/criu,rentzsch/criu,gablg1/criu,biddyweb/criu,AuthenticEshkinKot/criu,efiop/criu,efiop/criu,fbocharov/criu,efiop/criu,eabatalov/criu,biddyweb/criu,svloyso/criu,sdgdsffdsfff/criu,gonkulator/criu,tych0/criu,ldu4/criu,biddyweb/criu,svloyso/criu,biddyweb/criu,gonkulator/criu,rentzsch/criu,tych0/criu,tych0/criu,ldu4/criu,sdgdsffdsfff/criu,KKoukiou/criu-remote,gablg1/criu,rentzsch/criu,LK4D4/criu,eabatalov/criu,efiop/criu,fbocharov/criu,ldu4/criu,efiop/criu,wtf42/criu,rentzsch/criu,wtf42/criu,eabatalov/criu,eabatalov/criu,marcosnils/criu,gonkulator/criu,sdgdsffdsfff/criu,marcosnils/criu,tych0/criu,gonkulator/criu,KKoukiou/criu-remote,svloyso/criu