[CRIU] [PATCH 2/3] mnt: Read mount images early
Pavel Emelyanov
xemul at parallels.com
Wed Sep 23 07:21:02 PDT 2015
Mappings from mount id to namespace will be required to
remove ghosts on restore failure.
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
include/mount.h | 1 +
mount.c | 5 +----
namespaces.c | 5 +++++
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/include/mount.h b/include/mount.h
index bfb8477..b56aafd 100644
--- a/include/mount.h
+++ b/include/mount.h
@@ -118,6 +118,7 @@ extern int depopulate_roots_yard(void);
extern int rst_get_mnt_root(int mnt_id, char *path, int plen);
extern int ext_mount_add(char *key, char *val);
extern int mntns_maybe_create_roots(void);
+extern int read_mnt_ns_img(void);
extern void cleanup_mnt_ns(void);
#endif /* __CR_MOUNT_H__ */
diff --git a/mount.c b/mount.c
index 63d06fb..7c8dd9e 100644
--- a/mount.c
+++ b/mount.c
@@ -2509,7 +2509,7 @@ err:
return -1;
}
-static int read_mnt_ns_img(void)
+int read_mnt_ns_img(void)
{
struct mount_info *pms = NULL;
struct ns_id *nsid;
@@ -2673,9 +2673,6 @@ static int populate_mnt_ns(void)
struct mount_info *pms;
struct ns_id *nsid;
- if (read_mnt_ns_img())
- return -1;
-
pms = mnt_build_tree(mntinfo);
if (!pms)
return -1;
diff --git a/namespaces.c b/namespaces.c
index 135230e..6f50445 100644
--- a/namespaces.c
+++ b/namespaces.c
@@ -1324,8 +1324,13 @@ int prepare_namespace_before_tasks(void)
if (mntns_maybe_create_roots())
goto err_mnt;
+ if (read_mnt_ns_img())
+ goto err_img;
+
return 0;
+err_img:
+ cleanup_mnt_ns();
err_mnt:
/*
* Nothing, netns' descriptor will be closed
--
1.9.3
More information about the CRIU
mailing list