Skip to content

Commit

Permalink
Btrfs: fix lock leak when resuming snapshot deletion
Browse files Browse the repository at this point in the history
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,

Cc: [email protected]
Reported-by: Alex Lyakas <[email protected]>
Signed-off-by: Josef Bacik <[email protected]>
  • Loading branch information
Josef Bacik committed Jul 19, 2013
1 parent 3c8f242 commit fec386a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -7523,6 +7523,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
while (1) {
btrfs_tree_lock(path->nodes[level]);
btrfs_set_lock_blocking(path->nodes[level]);
path->locks[level] = BTRFS_WRITE_LOCK_BLOCKING;

ret = btrfs_lookup_extent_info(trans, root,
path->nodes[level]->start,
Expand All @@ -7538,6 +7539,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
break;

btrfs_tree_unlock(path->nodes[level]);
path->locks[level] = 0;
WARN_ON(wc->refs[level] != 1);
level--;
}
Expand Down

0 comments on commit fec386a

Please sign in to comment.