Skip to content

Commit fec386a

Browse files
author
Josef Bacik
committed
Btrfs: fix lock leak when resuming snapshot deletion
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]>
1 parent 3c8f242 commit fec386a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/btrfs/extent-tree.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7523,6 +7523,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
75237523
while (1) {
75247524
btrfs_tree_lock(path->nodes[level]);
75257525
btrfs_set_lock_blocking(path->nodes[level]);
7526+
path->locks[level] = BTRFS_WRITE_LOCK_BLOCKING;
75267527

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

75407541
btrfs_tree_unlock(path->nodes[level]);
7542+
path->locks[level] = 0;
75417543
WARN_ON(wc->refs[level] != 1);
75427544
level--;
75437545
}

0 commit comments

Comments
 (0)