[CRIU] [PATCH v2] dump: wait task stopped for 1 sec
Kinsbursky Stanislav
skinsbursky at openvz.org
Tue Jan 31 07:43:39 EST 2012
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 | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/cr-dump.c b/cr-dump.c
index 78d4b9b..c12c16e 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);
@@ -1197,6 +1198,7 @@ static int dump_one_task(struct pstree_item *item, struct cr_fdset *cr_fdset)
goto err;
}
+retry:
pr_info("Obtainting task stat ... ");
ret = parse_pid_stat(pid, pid_dir, &pps_buf);
if (ret < 0)
@@ -1208,6 +1210,12 @@ static int dump_one_task(struct pstree_item *item, struct cr_fdset *cr_fdset)
case 'T':
/* Stopped -- can dump one */
break;
+ case 'R':
+ if (attempt++ == 0) {
+ pr_err("Task is still in running state. Wait for 1 sec...\n");
+ sleep(1);
+ goto retry;
+ }
default:
ret = -1;
pr_err("Task in bad state: %c\n", pps_buf.state);
More information about the CRIU
mailing list