tsleep_interlock() - Fix bug in cpu_lwp_exit().
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 18 Jul 2009 00:55:52 +0000 (17:55 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 18 Jul 2009 00:55:52 +0000 (17:55 -0700)
* Fix a bug in cpu_lwp_exit() which could cause a TAILQ assertion due to
  a thread not being properly removed from the tsleep queue.

sys/platform/pc32/i386/vm_machdep.c
sys/platform/pc64/amd64/vm_machdep.c
sys/platform/vkernel/i386/vm_machdep.c

index df2b7f6..a698afc 100644 (file)
@@ -299,6 +299,8 @@ cpu_lwp_exit(void)
        td->td_gd->gd_cnt.v_swtch++;
 
        crit_enter_quick(td);
+       if (td->td_flags & TDF_TSLEEPQ)
+               tsleep_remove(td);
        lwkt_deschedule_self(td);
        lwkt_remove_tdallq(td);
        cpu_thread_exit();
index c774f7b..ae88ace 100644 (file)
@@ -265,6 +265,8 @@ cpu_lwp_exit(void)
        td->td_gd->gd_cnt.v_swtch++;
 
        crit_enter_quick(td);
+       if (td->td_flags & TDF_TSLEEPQ)
+               tsleep_remove(td);
        lwkt_deschedule_self(td);
        lwkt_remove_tdallq(td);
        cpu_thread_exit();
index 6ed08d0..d555634 100644 (file)
@@ -300,6 +300,8 @@ cpu_lwp_exit(void)
        td->td_gd->gd_cnt.v_swtch++;
 
        crit_enter_quick(td);
+       if (td->td_flags & TDF_TSLEEPQ)
+               tsleep_remove(td);
        lwkt_deschedule_self(td);
        lwkt_remove_tdallq(td);
        cpu_thread_exit();