hammer2 - Fix upgrade deadlock
commitb6b260f2b42aa5a135e4b57ce102dcb0dbbf88c3
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 10 Jun 2016 18:25:58 +0000 (10 11:25 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 11 Jun 2016 02:50:58 +0000 (10 19:50 -0700)
treeef0708febc8c76f103d7c41d83e865f986db2db3
parentf073608f1ef4bf6ab9cc04e0b4fac433b6cd2242
hammer2 - Fix upgrade deadlock

* Fix a deadlock which occurs when hammer2_chain_unlock() tries to
  upgrade the 'last' shared lock to exclusive.  This can deadlock if
  another thread obtains the chain shared before we manage to do the
  upgrade.

  Just use a 'try' here.  If it fails it means someone else got a lock
  (of any kind) and we don't have to worry about dropping the chain data.

* Replace hammer2_mtx_upgrade() with hammer2_mtx_upgrade_try().  Remove
  support for a blocking 'upgrade'.  It is no longer needed and it is
  too dangerous to have anyway.
sys/vfs/hammer2/hammer2.h
sys/vfs/hammer2/hammer2_chain.c