[CRIU] [crtools-bot for Cyrill Gorcunov ] restorer: Change endless loop to sys_exit in case of error

Cyrill Gorcunov gorcunov at openvz.org
Wed Feb 8 08:06:13 EST 2012


The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit 6a607827aad58b588c672f2c5660a9a3bca2dd05
Author: Cyrill Gorcunov <gorcunov at openvz.org>
Date:   Wed Feb 8 16:58:30 2012 +0400

    restorer: Change endless loop to sys_exit in case of error
    
    If an error happens during late restore stage, we better
    exit with error than dive into endless loop.
    
    The loop was useful at early prototype times,
    but not now when we use zdtm test suite.
    
    For example, force injected error now reports
    
     | Restoring EXE (/home/crtools/test/zdtm/live/static/selfexe00)
     | 764
     | 11308
     | Error (cr-restore.c:1280): 11308 exited, status=255
     | Error (cr-restore.c:1412): Someone can't be restored
    
    which is a way better than silent loop.
    
    Reported-by: Pavel Emelyanov <xemul at parallels.com>
    Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
    Acked-by: Pavel Emelyanov <xemul at parallels.com>
---
 restorer.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/restorer.c b/restorer.c
index d67288b..a814cb1 100644
--- a/restorer.c
+++ b/restorer.c
@@ -228,9 +228,8 @@ long restore_thread(struct thread_restore_args *args)
 	core_restore_end:
 		write_num_n(__LINE__);
 		write_num_n(sys_getpid());
-		for (;;)
-			local_sleep(5);
-		sys_exit(0);
+		sys_exit(-1);
+		return -1;
 }
 
 static long restore_self_exe_late(struct task_restore_core_args *args)
@@ -764,7 +763,6 @@ long restore_task(struct task_restore_core_args *args)
 core_restore_end:
 	write_num_n(__LINE__);
 	write_num_n(sys_getpid());
-	for (;;)
-		local_sleep(5);
-	sys_exit(0);
+	sys_exit(-1);
+	return -1;
 }


More information about the CRIU mailing list