Commit d4cfba89 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

restore: Bring original SIGCHLD handler back once task is restored

Otherwise if restored task exit we get error message in form

 | Error (cr-restore.c:1302): 7244 exited, status=0

while restored task simply finished working.
Pointed-out-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Acked-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 9d913b65
...@@ -1402,7 +1402,7 @@ static int restore_root_task(int fd, struct cr_options *opts) ...@@ -1402,7 +1402,7 @@ static int restore_root_task(int fd, struct cr_options *opts)
{ {
struct pstree_entry e; struct pstree_entry e;
int ret, i; int ret, i;
struct sigaction act; struct sigaction act, old_act;
unsigned long ns_clone_flags; unsigned long ns_clone_flags;
ret = read(fd, &e, sizeof(e)); ret = read(fd, &e, sizeof(e));
...@@ -1421,7 +1421,7 @@ static int restore_root_task(int fd, struct cr_options *opts) ...@@ -1421,7 +1421,7 @@ static int restore_root_task(int fd, struct cr_options *opts)
act.sa_flags |= SA_NOCLDWAIT | SA_NOCLDSTOP | SA_SIGINFO | SA_RESTART; act.sa_flags |= SA_NOCLDWAIT | SA_NOCLDSTOP | SA_SIGINFO | SA_RESTART;
act.sa_sigaction = sigchld_handler; act.sa_sigaction = sigchld_handler;
ret = sigaction(SIGCHLD, &act, NULL); ret = sigaction(SIGCHLD, &act, &old_act);
if (ret < 0) { if (ret < 0) {
perror("sigaction() failed\n"); perror("sigaction() failed\n");
return -1; return -1;
...@@ -1461,6 +1461,13 @@ static int restore_root_task(int fd, struct cr_options *opts) ...@@ -1461,6 +1461,13 @@ static int restore_root_task(int fd, struct cr_options *opts)
cr_wait_set(&task_entries->nr_in_progress, task_entries->nr); cr_wait_set(&task_entries->nr_in_progress, task_entries->nr);
cr_wait_set(&task_entries->start, CR_STATE_RESTORE_SIGCHLD); cr_wait_set(&task_entries->start, CR_STATE_RESTORE_SIGCHLD);
cr_wait_until(&task_entries->nr_in_progress, 0); cr_wait_until(&task_entries->nr_in_progress, 0);
ret = sigaction(SIGCHLD, &old_act, NULL);
if (ret < 0) {
perror("sigaction() failed\n");
return -1;
}
pr_info("Go on!!!\n"); pr_info("Go on!!!\n");
cr_wait_set(&task_entries->start, CR_STATE_COMPLETE); cr_wait_set(&task_entries->start, CR_STATE_COMPLETE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment