[CRIU] [PATCH 00/27] Restore nested mount namespaces (v4)

Andrey Vagin avagin at openvz.org
Thu Apr 10 04:03:43 PDT 2014


Systemd is able to execute a service in a new mount namespace.
It's used by Fedora and probably will be used in RHEL7.

All nested mount namespaces are restored as sub-trees of the root
namespace. A namespace is restored by a task with minimal pid in this
namespace. The task unshares mount namespace and makes pivot_root in a
proper sub-tree. All other task from the namespace attaches to the
namespace by calling setns().

Recently the mnt_id field was added in /proc/PID/fdinfo/X.
It allows us to know from which mount a file has been opened.
It's significant, if a few mount namespaces are restored.

Now mnt_id is saved for each file and on restore files are opened in
proper mount namespaces.

v2: write more descriptive comments
v3: don't leak fd on error path in dump_mnt_ns()
v4: fix Pavel's comments.

Andrey Vagin (27):
  mount: close old descriptor in mntns_collect_root
  mounts: initialize root before dumping mount namespace
  mounts: allow to customize root path for cr_pivot_root (v2)
  restore: add mount id-s in the ns_ids list (v4)
  mounts: mark local root-s in the list of mount points (v2)
  mounts: connect sub-root to the main root
  mounts: share one root for all namespaces
  mounts: prepare to create a temporary directory for restoring non-root
    mntns (v2)
  mounts: create a temporary directory for restoring non-root mntns
  crtools: restore nested mount namespaces (v2)
  mount: allow to dump and restore nested mount namespaces (v3)
  criu: rename current_ns_mask to root_ns_mask
  zdtm/mountpoints: test nested mount namespaces
  namespaces: dump mount namespaces before tasks (v2)
  ns: clean up dump_namespaces
  mount: save mount tree for each namespace
  files: save mnt_id on fd_param
  files: save mnt_id for reg files
  files-ids: generate id-s accoding with mnt_id, st->st_dev and
    st->st_ino
  servicefd: add a service fd for current root
  restore: look up root for each file
  zdtm: mark all mounts as private for one call
  zdtm: reexec the mountpoints test in a target mntns
  files: open ghost file relative to the proper root
  zdtm: check opened files in a second mntns
  mount: print error message if readlinkat failed
  mount: add a fast path for mntns_collect_root

 cr-dump.c                           |  77 ++++++---
 cr-restore.c                        |  43 +++--
 file-ids.c                          |  32 ++--
 files-reg.c                         |  53 +++++-
 files.c                             |   3 +-
 include/file-ids.h                  |   5 +-
 include/files.h                     |   2 +
 include/mount.h                     |  11 +-
 include/namespaces.h                |  13 +-
 include/proc_parse.h                |   2 +
 include/servicefd.h                 |   1 +
 include/syscall-types.h             |   3 +
 irmap.c                             |  10 +-
 mount.c                             | 325 ++++++++++++++++++++++++++++++++----
 namespaces.c                        |  90 ++++++++--
 net.c                               |   4 +-
 protobuf/regfile.proto              |   1 +
 pstree.c                            |  29 +++-
 sk-tcp.c                            |   8 +-
 sk-unix.c                           |   3 +
 sockets.c                           |   2 +-
 test/zdtm.sh                        |   1 +
 test/zdtm/lib/test.c                |  18 +-
 test/zdtm/live/static/mountpoints.c | 113 +++++++++++--
 tun.c                               |   2 +-
 25 files changed, 700 insertions(+), 151 deletions(-)

--
1.8.5.3



More information about the CRIU mailing list