[CRIU] [PATCH] pstree: Exit with error instead of BUG if image
corrupted
Cyrill Gorcunov
gorcunov at openvz.org
Fri Sep 28 03:17:03 EDT 2012
No need to panic if image corrupted and we can exit
out graciously.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
pstree.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/pstree.c b/pstree.c
index 33f56e1..6033e7e 100644
--- a/pstree.c
+++ b/pstree.c
@@ -150,7 +150,11 @@ int prepare_pstree(void)
max_pid = max((int)e->sid, max_pid);
if (e->ppid == 0) {
- BUG_ON(root_item);
+ if (root_item) {
+ pr_err("Parent missed on non-root task "
+ "with pid %d, image corruption!\n", e->pid);
+ goto err;
+ }
root_item = pi;
pi->parent = NULL;
INIT_LIST_HEAD(&pi->list);
@@ -198,6 +202,7 @@ int prepare_pstree(void)
pstree_entry__free_unpacked(e, NULL);
}
+err:
close(ps_fd);
return ret;
}
--
1.7.7.6
More information about the CRIU
mailing list