summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_sleepqueue.c
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2004-04-28 20:36:53 +0000
committerdeischen <deischen@FreeBSD.org>2004-04-28 20:36:53 +0000
commit122d328ccb51e6b9f7f19a2850a336f658546a9b (patch)
treeeb057d17b0ef06b7f741ec8ed3a383eba8487c94 /sys/kern/subr_sleepqueue.c
parent83ecd7781ef9028a17cdb24709202983677ba2d3 (diff)
downloadFreeBSD-src-122d328ccb51e6b9f7f19a2850a336f658546a9b.zip
FreeBSD-src-122d328ccb51e6b9f7f19a2850a336f658546a9b.tar.gz
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>
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 36f6850..1e50cc1 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
OpenPOWER on IntegriCloud