[PATCH 03/11] cr_tests: Always report an exit code that could indicate failure.

Matt Helsley matthltc at us.ibm.com
Wed Aug 19 21:58:06 PDT 2009


Restructure the exit paths of the children to always report the exit and
check the pass/fail variables before exiting.

Signed-off-by: Matt Helsley <matthltc at us.ibm.com>
Cc: containers at lists.linux-foundation.org
---
 futex/robust.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/futex/robust.c b/futex/robust.c
index 05fd4e9..f63b7d1 100644
--- a/futex/robust.c
+++ b/futex/robust.c
@@ -259,13 +259,14 @@ int kid(int i)
 {
 	if (set_robust_list(&rlist, sizeof(rlist)) < 0) {
 		log_error("set_robust_list");
-		fail++;
 		send_parent_status(&children_ready[1], CHILD_ERROR);
-		return -1;
+		fail++;
+		goto do_exit;
 	}
 	if (check_rlist(i) != 0) {
 		send_parent_status(&children_ready[1], CHILD_ERROR);
-		return -1;
+		fail++;
+		goto do_exit;
 	}
 
 	log("INFO", "signaling ready for checkpointing\n");
@@ -274,18 +275,20 @@ int kid(int i)
 
 	if (check_rlist(i) != 0) {
 		send_parent_status(&children_ready[1], CHILD_ERROR);
-		return -1;
+		fail++;
+		goto do_exit;
 	}
 
 	send_parent_status(&children_ready[1], CHILD_READY);
 	acquire_rfutex(test_futex, gettid());
+	pass++;
 
 	/*
 	 * Now exit instead of releasing the futex. This should cause
 	 * the kernel to wake the next waiter with FUTEX_OWNER_DIED.
 	 */
+do_exit:
 	log("INFO", "exiting\n");
-	pass++;
 	if (pass && !fail)
 		exit(EXIT_SUCCESS);
 	exit(EXIT_FAILURE);
-- 
1.5.6.3




More information about the Containers mailing list