Commit 14e86565 authored by Josef Bacik's avatar Josef Bacik Committed by Greg Kroah-Hartman

Btrfs: fix lock leak when resuming snapshot deletion

commit fec386ac upstream.

We aren't setting path->locks[level] when we resume a snapshot deletion which
means we won't unlock the buffer when we free the path.  This causes deadlocks
if we happen to re-allocate the block before we've evicted the extent buffer
from cache.  Thanks,
Reported-by: default avatarAlex Lyakas <alex.btrfs@zadarastorage.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent db60e49a
...@@ -7355,6 +7355,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, ...@@ -7355,6 +7355,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
while (1) { while (1) {
btrfs_tree_lock(path->nodes[level]); btrfs_tree_lock(path->nodes[level]);
btrfs_set_lock_blocking(path->nodes[level]); btrfs_set_lock_blocking(path->nodes[level]);
path->locks[level] = BTRFS_WRITE_LOCK_BLOCKING;
ret = btrfs_lookup_extent_info(trans, root, ret = btrfs_lookup_extent_info(trans, root,
path->nodes[level]->start, path->nodes[level]->start,
...@@ -7370,6 +7371,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, ...@@ -7370,6 +7371,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
break; break;
btrfs_tree_unlock(path->nodes[level]); btrfs_tree_unlock(path->nodes[level]);
path->locks[level] = 0;
WARN_ON(wc->refs[level] != 1); WARN_ON(wc->refs[level] != 1);
level--; level--;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment