[CRIU] [PATCH cr 08/10] dump: don't check xids

Andrey Vagin avagin at openvz.org
Tue Jun 19 08:46:59 EDT 2012


Now crtools can restore sid in all cases.
A restore of pgid will be added soon and now it will fail on restore.

It's prevent testing of restoring SIDs.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 cr-dump.c |   58 ----------------------------------------------------------
 1 files changed, 0 insertions(+), 58 deletions(-)

diff --git a/cr-dump.c b/cr-dump.c
index 6880740..5313963 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -1222,60 +1222,6 @@ static int collect_threads(struct pstree_item *item)
 	return ret;
 }
 
-/*
- * Few words about sid and pgid handling.
- *
- * An axiom: session can only be changed on self, group -- on self or
- * on one of self children.
- *
- * Conclusions:
- * 1. both should better be saved in pstree.img so we can restore sid
- *    at the time we fork kids and pgid is just for harmony;
- * 2. if we seized the parent these IDs* shouldn't change and it's safe
- *    to read and check them right at the seizing time.
- * 
- * Easings:
- * 1. with the existing setsid we can only reset sid to task's pid.
- *    Thus, if task escaped from its ancestors with sid we will not be
- *    able to easily restore this construction. Thus for now this is
- *    treated as "unsupported" (FIXME);
- *
- * 2. when task whose pid is equal to pgid/sid (i.e. leader) exits we
- *    lose the ability to restore the grp/session easily with the 
- *    existing interfaces, thus we also treat this as temporarily
- *    unsupported (FIXME #2).
- */
-
-static int check_xids(struct pstree_item *root_item)
-{
-	struct pstree_item *p, *tmp;
-
-	for_each_pstree_item(p) {
-		if (p->parent == NULL)
-			continue;
-
-		/* Easing #1 and #2 for sids */
-		if ((p->sid != p->pid) && (p->sid != p->parent->sid)) {
-			pr_err("SID mismatch on %d (%d/%d)\n",
-					p->pid, p->sid, p->parent->sid);
-			return -1;
-		}
-
-		/* Easing #2 for pgids */
-		for_each_pstree_item(tmp)
-			if (tmp->pid == p->pgid)
-				break;
-
-		if (tmp == NULL) {
-			pr_err("PGIG mismatch on %d (%d)\n",
-					p->pid, p->pgid);
-			return -1;
-		}
-	}
-
-	return 0;
-}
-
 static int collect_task(struct pstree_item *item)
 {
 	int ret;
@@ -1426,10 +1372,6 @@ static int dump_pstree(struct pstree_item *root_item)
 	pr_info("Dumping pstree (pid: %d)\n", root_item->real_pid);
 	pr_info("----------------------------------------\n");
 
-	ret = check_xids(root_item);
-	if (ret)
-		return -1;
-
 	pstree_fd = open_image(CR_FD_PSTREE, O_DUMP);
 	if (pstree_fd < 0)
 		return -1;
-- 
1.7.1



More information about the CRIU mailing list