[CRIU] [crtools-bot for Pavel Emelyanov ] dump: Remove
SHOULD_BE_DEAD task state
Cyrill Gorcunov
gorcunov at openvz.org
Thu Mar 1 10:31:20 EST 2012
The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit f8a18edd4453f86835349da7a7c1e01d57db6d3e
Author: Pavel Emelyanov <xemul at parallels.com>
Date: Thu Mar 1 19:03:09 2012 +0400
dump: Remove SHOULD_BE_DEAD task state
Move proc checks for Z-state into seize_task().
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
cr-dump.c | 20 ++------------------
include/image.h | 1 -
ptrace.c | 18 ++++++++++++++++--
3 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/cr-dump.c b/cr-dump.c
index e490974..e32b597 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -852,8 +852,8 @@ static int seize_threads(struct pstree_item *item)
if (ret < 0)
goto err;
- if (ret == TASK_SHOULD_BE_DEAD) {
- pr_err("Potentially zombie thread not supported\n");
+ if (ret == TASK_DEAD) {
+ pr_err("Zombie thread not supported\n");
goto err;
}
@@ -904,22 +904,6 @@ static struct pstree_item *collect_task(pid_t pid, struct list_head *list)
item->pid = pid;
item->state = ret;
- if (item->state == TASK_SHOULD_BE_DEAD) {
- struct proc_pid_stat_small ps;
-
- ret = parse_pid_stat_small(pid, &ps);
- if (ret < 0)
- goto err_close;
-
- if (ps.state != 'Z') {
- pr_err("Unseizeable non-zombie %d found, state %c\n",
- item->pid, ps.state);
- goto err_close;
- }
-
- item->state = TASK_DEAD;
- }
-
ret = collect_threads(item);
if (ret < 0)
goto err_close;
diff --git a/include/image.h b/include/image.h
index db4015f..45f55eb 100644
--- a/include/image.h
+++ b/include/image.h
@@ -367,7 +367,6 @@ struct core_entry {
};
} __packed;
-#define TASK_SHOULD_BE_DEAD 0x0
#define TASK_ALIVE 0x1
#define TASK_DEAD 0x2
#define TASK_STOPPED 0x3 /* FIXME - implement */
diff --git a/ptrace.c b/ptrace.c
index ce1ed7f..3abb5e5 100644
--- a/ptrace.c
+++ b/ptrace.c
@@ -18,6 +18,7 @@
#include "types.h"
#include "util.h"
#include "ptrace.h"
+#include "proc_parse.h"
int unseize_task(pid_t pid, enum cr_task_state st)
{
@@ -47,8 +48,21 @@ int seize_task(pid_t pid)
ret = ptrace(PTRACE_SEIZE, pid, NULL,
(void *)(unsigned long)PTRACE_SEIZE_DEVEL);
- if (ret < 0)
- return TASK_SHOULD_BE_DEAD; /* Caller should verify it's really dead */
+ if (ret < 0) {
+ struct proc_pid_stat_small ps;
+
+ ret = parse_pid_stat_small(pid, &ps);
+ if (ret < 0)
+ return -1;
+
+ if (ps.state != 'Z') {
+ pr_err("Unseizeable non-zombie %d found, state %c\n",
+ pid, ps.state);
+ return -1;
+ }
+
+ return TASK_DEAD;
+ }
ret = ptrace(PTRACE_INTERRUPT, pid, NULL, NULL);
if (ret < 0) {
More information about the CRIU
mailing list