Hold proc->lock while killing the process
This commit is contained in:
@@ -24,12 +24,6 @@
|
||||
#include <amd64/intr_defs.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Lock ordering:
|
||||
* 1. proc_tree_lock
|
||||
* 2. [cpu]->lock
|
||||
*/
|
||||
|
||||
static struct rb_node_link* proc_tree = NULL;
|
||||
static spin_lock_t proc_tree_lock = SPIN_LOCK_INIT;
|
||||
|
||||
@@ -266,7 +260,9 @@ void proc_kill (struct proc* proc) {
|
||||
atomic_store (&proc->state, PROC_DEAD);
|
||||
|
||||
spin_lock (&proc_tree_lock);
|
||||
spin_lock (&proc->lock);
|
||||
rbtree_delete (&proc_tree, &proc->proc_tree_link);
|
||||
spin_unlock (&proc->lock);
|
||||
spin_unlock (&proc_tree_lock);
|
||||
|
||||
struct cpu* cpu = proc->cpu;
|
||||
|
||||
Reference in New Issue
Block a user