kernel - Fix panic related to kqueue-based timers
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 7 Sep 2011 22:48:07 +0000 (15:48 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 7 Sep 2011 22:48:07 +0000 (15:48 -0700)
commitb90e37ec76a8f3cfd0c32fa2bd292cb261773d85
treed99a982757280b8a7888b0205fa2e2a1dfc3d660
parentefba76b4e799bdf82bd255a0dd06d36c3f5a82c5
kernel - Fix panic related to kqueue-based timers

* Fix a panic related to kqueue-based timers.  When a knote is destroyed it
  is possible for the callout_stop() to race a callout on another cpu that
  is blocked on a lock.

* Introduce callout_terminate() which stops a callout and ensures that no
  function calls for the callout is still in progress before returning.
  The kevent code now uses this function instead of callout_stop().

* We can't have this assurance for the normal callout_stop() function because
  it can deadlock a backend stuck waiting for a lock when a frontend holding
  that lock calls callout_stop().

Reported-by: Antonio Huete Jimenez <tuxillo@quantumachine.net>
sys/kern/kern_event.c
sys/kern/kern_timeout.c