Commit f8a18edd authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Cyrill Gorcunov

dump: Remove SHOULD_BE_DEAD task state

Move proc checks for Z-state into seize_task().
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 3f256945
...@@ -852,8 +852,8 @@ static int seize_threads(struct pstree_item *item) ...@@ -852,8 +852,8 @@ static int seize_threads(struct pstree_item *item)
if (ret < 0) if (ret < 0)
goto err; goto err;
if (ret == TASK_SHOULD_BE_DEAD) { if (ret == TASK_DEAD) {
pr_err("Potentially zombie thread not supported\n"); pr_err("Zombie thread not supported\n");
goto err; goto err;
} }
...@@ -904,22 +904,6 @@ static struct pstree_item *collect_task(pid_t pid, struct list_head *list) ...@@ -904,22 +904,6 @@ static struct pstree_item *collect_task(pid_t pid, struct list_head *list)
item->pid = pid; item->pid = pid;
item->state = ret; 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); ret = collect_threads(item);
if (ret < 0) if (ret < 0)
goto err_close; goto err_close;
......
...@@ -367,7 +367,6 @@ struct core_entry { ...@@ -367,7 +367,6 @@ struct core_entry {
}; };
} __packed; } __packed;
#define TASK_SHOULD_BE_DEAD 0x0
#define TASK_ALIVE 0x1 #define TASK_ALIVE 0x1
#define TASK_DEAD 0x2 #define TASK_DEAD 0x2
#define TASK_STOPPED 0x3 /* FIXME - implement */ #define TASK_STOPPED 0x3 /* FIXME - implement */
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "types.h" #include "types.h"
#include "util.h" #include "util.h"
#include "ptrace.h" #include "ptrace.h"
#include "proc_parse.h"
int unseize_task(pid_t pid, enum cr_task_state st) int unseize_task(pid_t pid, enum cr_task_state st)
{ {
...@@ -47,8 +48,21 @@ int seize_task(pid_t pid) ...@@ -47,8 +48,21 @@ int seize_task(pid_t pid)
ret = ptrace(PTRACE_SEIZE, pid, NULL, ret = ptrace(PTRACE_SEIZE, pid, NULL,
(void *)(unsigned long)PTRACE_SEIZE_DEVEL); (void *)(unsigned long)PTRACE_SEIZE_DEVEL);
if (ret < 0) if (ret < 0) {
return TASK_SHOULD_BE_DEAD; /* Caller should verify it's really dead */ 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); ret = ptrace(PTRACE_INTERRUPT, pid, NULL, NULL);
if (ret < 0) { if (ret < 0) {
......
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