[CRIU] [PATCH 0/3] Rework restoring mount namespaces

Andrey Vagin avagin at openvz.org
Sat Nov 14 22:07:02 PST 2015


From: Andrew Vagin <avagin at virtuozzo.com>

Currently we have two problems:
* close_old_fds() is called after forking children. This doesn't work when
  processes shared file descriptor table. In this case each of them has its
  own set of service file descriptors and close_old_fds() knows nothing about
  this.
* the procfs is mounted too late.

===================== Run zdtm/live/static/fdt_shared in h =====================
Start test
./fdt_shared --pidfile=fdt_shared.pid --outfile=fdt_shared.out --filename=fdt_shared.test
Run criu dump
Run criu restore
------------------------ grep Error ------------------------
(00.012029)     72: Error (util.c:109): Unable to close fd 4: Bad file descriptor
(00.013044)     72: Error (cr-restore.c:1253): 74 exited, status=1
(00.013059) Error (cr-restore.c:1982): Restoring FAILED.
------------------------ ERROR OVER ------------------------

==================== Run zdtm/live/static/clean_mntns in ns ====================
Start test
Test is SUID
./clean_mntns --pidfile=clean_mntns.pid --outfile=clean_mntns.out
Run criu dump
Run criu restore
------------------------ grep Error ------------------------
(00.238263)      1: Error (util.c:279): Can't open self: No such file or directory
(00.238291)      1: Error (mount.c:2823): mnt: Can't open 0/ns/mnt on procfs: No such file or directory
(00.238536) Error (cr-restore.c:1982): Restoring FAILED.
------------------------ ERROR OVER ------------------------

Reported-by: Mr Jenkins
Fixes: 9d60724eca71 ("restore: restore mntns before creating private vma-s (v3)")

Andrew Vagin (3):
  mount: don't inherit mount namespace descriptors to each process
  restore: call close_old_fds() before forking children
  pstree: set ids for helpers

 cr-restore.c    | 25 +++++++++++++++----------
 include/mount.h |  1 +
 mount.c         | 25 ++++++++++++++++++++++---
 pstree.c        |  2 ++
 4 files changed, 40 insertions(+), 13 deletions(-)

-- 
2.4.3



More information about the CRIU mailing list