kernel - Fix not-quite-nonblocking VX lock in allocfreevnode()
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 15 Jan 2010 05:51:45 +0000 (21:51 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 15 Jan 2010 05:51:45 +0000 (21:51 -0800)
commit298693f7a0177ad2291be7a6c52371fb311b4a17
tree7229991e5c99423a417fb0145787800f14eb831f
parent86e17bb6e4914eb10231b46309c4c7e6169a2401
kernel - Fix not-quite-nonblocking VX lock in allocfreevnode()

* Introduce LK_NOSPINWAIT to tell lockmgr() to not even spin on the
  spinlock if it can't get it immediately.

* There is a lock order reversal between vfs_spin and vp->v_spinlock
  where vx_lock_nonblock() can deadlock in allocfreevnode().  Normally
  I'd vhold() the vnode but the freelist code is rather fragile and I
  don't want to have to vdrop() later on.  So instead use LK_NOSPINWAIT
  to avoid the situation.

* This is a hack.
sys/kern/kern_lock.c
sys/kern/vfs_lock.c
sys/sys/lock.h