[2/4] restore: Add more detailed log in wait_exiting_children

Submitted by Cyrill Gorcunov on Dec. 7, 2018, 11:57 a.m.

Details

Message ID 20181207115712.24130-3-gorcunov@gmail.com
State New
Series "restore: Fix potential hung on restore"
Headers show

Commit Message

Cyrill Gorcunov Dec. 7, 2018, 11:57 a.m.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 criu/cr-restore.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index d915615dfce3..ea4a599b303c 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1007,7 +1007,7 @@  static int wait_on_helpers_zombies(void)
 	return 0;
 }
 
-static int wait_exiting_children(void);
+static int wait_exiting_children(char *prefix);
 
 static int restore_one_zombie(CoreEntry *core)
 {
@@ -1024,7 +1024,7 @@  static int restore_one_zombie(CoreEntry *core)
 	prctl(PR_SET_NAME, (long)(void *)core->tc->comm, 0, 0, 0);
 
 	if (task_entries != NULL) {
-		wait_exiting_children();
+		wait_exiting_children("zombie");
 		zombie_prepare_signals();
 	}
 
@@ -1134,6 +1134,9 @@  static bool child_death_expected(void)
 		switch (pi->pid->state) {
 		case TASK_DEAD:
 		case TASK_HELPER:
+			pr_debug("\texpecting %s child %d to exit\n",
+				 pi->pid->state == TASK_DEAD ?
+				 "zombie" : "helper", vpid(pi));
 			return true;
 		}
 	}
@@ -1141,11 +1144,12 @@  static bool child_death_expected(void)
 	return false;
 }
 
-static int wait_exiting_children(void)
+static int wait_exiting_children(char *prefix)
 {
 	siginfo_t info;
 
 	if (!child_death_expected()) {
+		pr_debug("%s: no exiting children expected\n", prefix);
 		/*
 		 * Restoree has no children that should die, during restore,
 		 * wait for the next stage on futex.
@@ -1156,6 +1160,8 @@  static int wait_exiting_children(void)
 		return 0;
 	}
 
+	pr_debug("%s: gonna wait for children to exit\n", prefix);
+
 	/*
 	 * The restoree has children which will die - decrement itself from
 	 * nr. of tasks processing the stage and wait for anyone to die.
@@ -1184,6 +1190,7 @@  static int wait_exiting_children(void)
 		return -1;
 	}
 
+	pr_debug("%s: finished waiting for children to exit\n", prefix);
 	return 0;
 }
 
@@ -1202,7 +1209,7 @@  static int restore_one_helper(void)
 	if (prepare_fds(current))
 		return -1;
 
-	if (wait_exiting_children())
+	if (wait_exiting_children("helper"))
 		return -1;
 
 	sfds_protected = false;