[CRIU] [PATCH 2/6] pstree: Check for always existing task ids on restore
Kirill Tkhai
ktkhai at virtuozzo.com
Thu May 11 04:50:27 PDT 2017
All alive task must have have ids and the fields,
implemented before the img format became stable
(see commit 2105e18eee70).
Check for them in the only place (in additional to the
check for has_pid_ns_id, which we already have)
and this will allow to remove checks for item->ids and
for item->ids->has_xxx_ns_id from the rest of code
and make it simplier. See patch "pstree: Delete checks
of always existing pstree_item::ids on restore" in further)
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/pstree.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/criu/pstree.c b/criu/pstree.c
index f99758c6f..9c2214b04 100644
--- a/criu/pstree.c
+++ b/criu/pstree.c
@@ -625,6 +625,17 @@ static int read_pstree_ids(pid_t pid, TaskKobjIdsEntry **ids)
ADD_OR_COPY_ID(ids, uts);
ADD_OR_COPY_ID(ids, cgroup);
+ if (!ret && (!(*ids)->has_pid_ns_id || !(*ids)->has_net_ns_id ||
+ !(*ids)->ipc_ns_id || !(*ids)->uts_ns_id || !(*ids)->mnt_ns_id)) {
+ /*
+ * At least root_item must have the fields,
+ * implemented before the img format became
+ * stable (commit 2105e18eee70).
+ */
+ pr_err("No task ids or always dumped ns ids\n");
+ ret = -1;
+ }
+
if (!ret && (*ids)->has_pid_ns_id) {
if (!top_pid_ns) {
/*
@@ -737,15 +748,6 @@ static int read_pstree_image(pid_t *pid_max)
ids = parent->ids;
}
- if (!ids->has_pid_ns_id) {
- /*
- * At least root_item must have ids, and pid_ns_id field
- * was populated since ids are introduced.
- */
- pr_err("No pid_ns id\n");
- break;
- }
-
pi = lookup_create_item((pid_t *)e->ns_pid, e->n_ns_pid, ids->pid_ns_id);
if (pi == NULL)
break;
More information about the CRIU
mailing list