kernel - Fix list corruption in dsched
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 12 Feb 2011 21:30:16 +0000 (13:30 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 12 Feb 2011 21:30:16 +0000 (13:30 -0800)
commit0b81692c192f8106f3048aff53e3f6f77731d565
treecbb863f989f486c09ebd247bf0e18281bb7dac27
parentd5b09666ded14e06fc1b9641d4e8d4e1fc181eff
kernel - Fix list corruption in dsched

* dsched_thread_ctx_alloc() was not acquiring the global lock across
  calls to dsched_thread_io_alloc(), creating a race condition in the
  call to TAILQ_INSERT_TAIL(&tdio->diskctx->tdio_list, ...).

  This case can occur under heavy fork/exit loads, particularly when
  (soon) fork and exit get out from the MP lock, but even with the MP
  lock on the frontend it can occur against the dsched backend.

* dsched_new_policy_thread_tdio() was not acquiring the global lock
  across its initial call to dsched_thread_io_alloc().  This case could
  only occur with extreme rarity.
sys/kern/kern_dsched.c