[CRIU] [PATCH] pstree_item: Keep creds field on dump_info tail

Pavel Emelyanov xemul at parallels.com
Thu Jun 25 07:54:28 PDT 2015


And rename it for easier grepping

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 cr-dump.c        | 12 ++++++------
 include/pstree.h | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/cr-dump.c b/cr-dump.c
index 8936a64..fd71a15 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -676,10 +676,10 @@ static int dump_task_core_all(struct pstree_item *item,
 	if (ret < 0)
 		goto err;
 
-	if (item->creds->seccomp_mode != SECCOMP_MODE_DISABLED) {
-		pr_info("got seccomp mode %d for %d\n", item->creds->seccomp_mode, item->pid.virt);
+	if (dmpi(item)->pi_creds->seccomp_mode != SECCOMP_MODE_DISABLED) {
+		pr_info("got seccomp mode %d for %d\n", dmpi(item)->pi_creds->seccomp_mode, item->pid.virt);
 		core->tc->has_seccomp_mode = true;
-		core->tc->seccomp_mode = item->creds->seccomp_mode;
+		core->tc->seccomp_mode = dmpi(item)->pi_creds->seccomp_mode;
 	}
 
 	strncpy((char *)core->tc->comm, stat->comm, TASK_COMM_LEN);
@@ -811,7 +811,7 @@ static int collect_children(struct pstree_item *item)
 			goto free;
 		}
 
-		ret = seize_task(pid, item->pid.real, &c->creds);
+		ret = seize_task(pid, item->pid.real, &dmpi(c)->pi_creds);
 		if (ret < 0) {
 			/*
 			 * Here is a race window between parse_children() and seize(),
@@ -923,7 +923,7 @@ static int collect_threads(struct pstree_item *item)
 		pr_info("\tSeizing %d's %d thread\n",
 				item->pid.real, pid);
 
-		ret = seize_task(pid, item_ppid(item), &item->creds);
+		ret = seize_task(pid, item_ppid(item), &dmpi(item)->pi_creds);
 		if (ret < 0) {
 			/*
 			 * Here is a race window between parse_threads() and seize(),
@@ -1073,7 +1073,7 @@ static int collect_pstree(pid_t pid)
 		return -1;
 
 	root_item->pid.real = pid;
-	ret = seize_task(pid, -1, &root_item->creds);
+	ret = seize_task(pid, -1, &dmpi(root_item)->pi_creds);
 	if (ret < 0)
 		goto err;
 	pr_info("Seized task %d, state %d\n", pid, ret);
diff --git a/include/pstree.h b/include/pstree.h
index 10c5021..7583315 100644
--- a/include/pstree.h
+++ b/include/pstree.h
@@ -30,12 +30,6 @@ struct pstree_item {
 	 */
 	bool			has_seccomp;
 
-	/*
-	 * We keep the creds here so that we can compare creds while seizing
-	 * threads. Dumping tasks with different creds is not supported.
-	 */
-	struct proc_status_creds *creds;
-
 	int			nr_threads;	/* number of threads */
 	struct pid		*threads;	/* array of threads */
 	CoreEntry		**core;
@@ -51,6 +45,12 @@ static inline struct rst_info *rsti(struct pstree_item *i)
 struct ns_id;
 struct dmp_info {
 	struct ns_id *netns;
+	/*
+	 * We keep the creds here so that we can compare creds while seizing
+	 * threads. Dumping tasks with different creds is not supported.
+	 */
+	struct proc_status_creds *pi_creds;
+
 };
 
 static inline struct dmp_info *dmpi(struct pstree_item *i)
-- 
1.9.3



More information about the CRIU mailing list