]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: fix deadlocks with trylock on tree nodes
authorChris Mason <clm@fb.com>
Thu, 19 Jun 2014 21:16:52 +0000 (14:16 -0700)
committerChris Mason <clm@fb.com>
Thu, 19 Jun 2014 21:19:55 +0000 (14:19 -0700)
commit1192c2e0ae5e26d37757318ac189829072af0123
tree11b920acf6dbd78624112a675bff5d06fb4ad6d5
parentee9d7492c25d0b1c63dc9b93abd202590b6c98c3
Btrfs: fix deadlocks with trylock on tree nodes

The Btrfs tree trylock function is poorly named.  It always takes
the spinlock and backs off if the blocking lock is held.  This
can lead to surprising lockups because people expect it to really be a
trylock.

This commit makes it a pure trylock, both for the spinlock and the
blocking lock.  It also reworks the nested lock handling slightly to
avoid taking the read lock while a spinning write lock might be held.

Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/locking.c