Commit e8f48400 authored by Pavel Emelyanov's avatar Pavel Emelyanov

dump: Add some comments to tasks collecting code

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 2fe5884d
...@@ -939,6 +939,12 @@ static int collect_subtree(struct pstree_item *item) ...@@ -939,6 +939,12 @@ static int collect_subtree(struct pstree_item *item)
return -1; return -1;
} }
/*
* Tasks may clone() with the CLONE_PARENT flag while we collect
* them, making more kids to their parent. So before proceeding
* check that the parent we're working on has no more kids born.
*/
if (check_subtree(item)) if (check_subtree(item))
return -1; return -1;
...@@ -1652,6 +1658,12 @@ int cr_dump_tasks(pid_t pid) ...@@ -1652,6 +1658,12 @@ int cr_dump_tasks(pid_t pid)
if (connect_to_page_server()) if (connect_to_page_server())
goto err; goto err;
/*
* The collect_pstree will also stop (PTRACE_SEIZE) the tasks
* thus ensuring that they don't modify anything we collect
* afterwards.
*/
if (collect_pstree(pid)) if (collect_pstree(pid))
goto err; goto err;
......
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