Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 198
b: refs/heads/master
c: d28446f
h: refs/heads/master
v: v3
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Apr 16, 2005
1 parent 6b9fa9e commit 93c6946
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 187a27845a9dc1c3da3995e24625ccf2e7a346aa
refs/heads/master: d28446fe2d87ea344c14741c39962dcc7aee5c78
20 changes: 8 additions & 12 deletions trunk/drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -2840,26 +2840,22 @@ mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev,
return thread;
}

static void md_interrupt_thread(mdk_thread_t *thread)
{
if (!thread->tsk) {
MD_BUG();
return;
}
dprintk("interrupting MD-thread pid %d\n", thread->tsk->pid);
send_sig(SIGKILL, thread->tsk, 1);
}

void md_unregister_thread(mdk_thread_t *thread)
{
struct completion event;

init_completion(&event);

thread->event = &event;

/* As soon as ->run is set to NULL, the task could disappear,
* so we need to hold tasklist_lock until we have sent the signal
*/
dprintk("interrupting MD-thread pid %d\n", thread->tsk->pid);
read_lock(&tasklist_lock);
thread->run = NULL;
thread->name = NULL;
md_interrupt_thread(thread);
send_sig(SIGKILL, thread->tsk, 1);
read_unlock(&tasklist_lock);
wait_for_completion(&event);
kfree(thread);
}
Expand Down

0 comments on commit 93c6946

Please sign in to comment.