aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/subr_sleepqueue.c
diff options
context:
space:
mode:
authorDaniel Eischen <deischen@FreeBSD.org>2004-04-28 20:36:53 +0000
committerDaniel Eischen <deischen@FreeBSD.org>2004-04-28 20:36:53 +0000
commit4fc21c09473f1c7c7974cf45af054cb273774b0e (patch)
treeeb057d17b0ef06b7f741ec8ed3a383eba8487c94 /sys/kern/subr_sleepqueue.c
parentd7837b06fe1c5a4e4ab9c3a7cae3efc1dde87f69 (diff)
downloadsrc-4fc21c09473f1c7c7974cf45af054cb273774b0e.tar.gz
src-4fc21c09473f1c7c7974cf45af054cb273774b0e.zip
Keep track of threads waiting in kse_release() to avoid a race
condition where kse_wakeup() doesn't yet see them in (interruptible) sleep queues. Also add an upcall check to sleepqueue_catch_signals() suggested by jhb. This commit should fix recent mysql hangs. Reviewed by: jhb, davidxu Mysql'd by: Robin P. Blanchard <robin.blanchard at gactr uga edu>
Notes
Notes: svn path=/head/; revision=128721
Diffstat (limited to 'sys/kern/subr_sleepqueue.c')
-rw-r--r--sys/kern/subr_sleepqueue.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c
index 36f68505165d..1e50cc1814c4 100644
--- a/sys/kern/subr_sleepqueue.c
+++ b/sys/kern/subr_sleepqueue.c
@@ -293,8 +293,10 @@ sleepq_catch_signals(void *wchan)
struct sleepqueue *sq;
struct thread *td;
struct proc *p;
+ int do_upcall;
int sig;
+ do_upcall = 0;
td = curthread;
p = td->td_proc;
sc = SC_LOOKUP(wchan);
@@ -318,6 +320,8 @@ sleepq_catch_signals(void *wchan)
mtx_unlock(&p->p_sigacts->ps_mtx);
if (sig == 0 && thread_suspend_check(1))
sig = SIGSTOP;
+ else
+ do_upcall = thread_upcall_check(td);
PROC_UNLOCK(p);
/*
@@ -326,7 +330,7 @@ sleepq_catch_signals(void *wchan)
*/
sq = sleepq_lookup(wchan);
mtx_lock_spin(&sched_lock);
- if (TD_ON_SLEEPQ(td) && sig != 0) {
+ if (TD_ON_SLEEPQ(td) && (sig != 0 || do_upcall != 0)) {
mtx_unlock_spin(&sched_lock);
sleepq_wakeup_thread(sq, td, -1);
} else