[CRIU] Re: [PATCH] dump: wait task stopped for 1 sec
Stanislav Kinsbursky
skinsbursky at parallels.com
Tue Jan 31 07:40:50 EST 2012
Drop it. Will make better version.
31.01.2012 16:40, Kinsbursky Stanislav пишет:
> From: Stanislav Kinsbursky<skinsbursky at parallels.com>
>
> Wait for 1 sec in case of task is not stopped to dump stage and check it's
> state once more.
> Should help against this error:
>
> Obtainting task stat ... Error (cr-dump.c:1213): Task in bad state: R
>
> Signed-off-by: Stanislav Kinsbursky<skinsbursky at parallels.com>
>
> ---
> cr-dump.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/cr-dump.c b/cr-dump.c
> index 78d4b9b..af31a89 100644
> --- a/cr-dump.c
> +++ b/cr-dump.c
> @@ -1186,6 +1186,7 @@ static int dump_one_task(struct pstree_item *item, struct cr_fdset *cr_fdset)
> int ret = -1;
> int pid_dir;
> struct parasite_dump_misc misc;
> + int attempt = 0;
>
> pr_info("========================================\n");
> pr_info("Dumping task (pid: %d)\n", pid);
> @@ -1198,6 +1199,7 @@ static int dump_one_task(struct pstree_item *item, struct cr_fdset *cr_fdset)
> }
>
> pr_info("Obtainting task stat ... ");
> +retry:
> ret = parse_pid_stat(pid, pid_dir,&pps_buf);
> if (ret< 0)
> goto err;
> @@ -1209,6 +1211,11 @@ static int dump_one_task(struct pstree_item *item, struct cr_fdset *cr_fdset)
> /* Stopped -- can dump one */
> break;
> default:
> + if (attempt++ == 0) {
> + sleep(1);
> + pr_err("Trying once more\n");
> + goto retry;
> + }
> ret = -1;
> pr_err("Task in bad state: %c\n", pps_buf.state);
> goto err;
>
--
Best regards,
Stanislav Kinsbursky
More information about the CRIU
mailing list