[CRIU] [PATCH 2/4] dump: dump pstree outside tasks loop

Kinsbursky Stanislav skinsbursky at openvz.org
Fri Mar 16 06:25:40 EDT 2012


From: Stanislav Kinsbursky <skinsbursky at openvz.org>

This is a cleanup patch.

Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
 cr-dump.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
-------------- next part --------------
diff --git a/cr-dump.c b/cr-dump.c
index 6c71c84..ef72471 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -1434,18 +1434,18 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts)
 
 	collect_sockets();
 
+	cr_fdset = cr_dump_fdset_open(pid, CR_FD_DESC_USE(CR_FD_PSTREE), cr_fdset);
+	if (!cr_fdset)
+		goto err;
+	if (dump_pstree(pid, &pstree_list, cr_fdset))
+		goto err;
+	close_cr_fdset(&cr_fdset);
+
 	list_for_each_entry(item, &pstree_list, list) {
 		cr_fdset = cr_dump_fdset_open(item->pid, CR_FD_DESC_NONE, NULL);
 		if (!cr_fdset)
 			goto err;
 
-		if (item->pid == pid) {
-			if (!cr_dump_fdset_open(item->pid, CR_FD_DESC_USE(CR_FD_PSTREE), cr_fdset))
-				goto err;
-			if (dump_pstree(pid, &pstree_list, cr_fdset))
-				goto err;
-		}
-
 		/*
 		 * Prepare for socket queues in advance. They are not per-task,
 		 * but per-someother-task which makes restore tricky. Thus save


More information about the CRIU mailing list