diff options
author | Zhaolei <zhaolei@cn.fujitsu.com> | 2015-08-06 10:39:36 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-08-09 10:07:14 -0400 |
commit | 166f66d0bc94a14ec4bc6ee6ab079532df4a8d9e (patch) | |
tree | 276972a024d58650bcf98113bfd264b9ff1c3fb5 | |
parent | 9ed0dea09fc5e8cb1926c15fc986a46a2db43da6 (diff) |
btrfs: Add WARN_ON() for double lock in btrfs_tree_lock()
When a task trying to double lock a extent buffer, there are no
lockdep warning about it because this lock may be in "blocking_lock"
state, and make us hard to debug.
This patch add a WARN_ON() for above condition, it can not report
all deadlock cases(as lock between tasks), but at least helps us
some.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r-- | fs/btrfs/locking.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c index f8229ef1b46d..d7e6baf1b205 100644 --- a/fs/btrfs/locking.c +++ b/fs/btrfs/locking.c | |||
@@ -241,6 +241,7 @@ void btrfs_tree_read_unlock_blocking(struct extent_buffer *eb) | |||
241 | */ | 241 | */ |
242 | void btrfs_tree_lock(struct extent_buffer *eb) | 242 | void btrfs_tree_lock(struct extent_buffer *eb) |
243 | { | 243 | { |
244 | WARN_ON(eb->lock_owner == current->pid); | ||
244 | again: | 245 | again: |
245 | wait_event(eb->read_lock_wq, atomic_read(&eb->blocking_readers) == 0); | 246 | wait_event(eb->read_lock_wq, atomic_read(&eb->blocking_readers) == 0); |
246 | wait_event(eb->write_lock_wq, atomic_read(&eb->blocking_writers) == 0); | 247 | wait_event(eb->write_lock_wq, atomic_read(&eb->blocking_writers) == 0); |