History

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,

Josef Bacik committed 13 years ago

Commit fec386a1 parent 3c8f2421 file · +2 −0Browse files

Unified · Split

fs/btrfs/extent-tree.c+2−0
@@ -7523,6 +7523,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, · 7522 unmodified lines
7523 while (1) {7523 while (1) {
7524 btrfs_tree_lock(path->nodes[level]);7524 btrfs_tree_lock(path->nodes[level]);
7525 btrfs_set_lock_blocking(path->nodes[level]);7525 btrfs_set_lock_blocking(path->nodes[level]);
7526 path->locks[level] = BTRFS_WRITE_LOCK_BLOCKING;
7526 7527
7527 ret = btrfs_lookup_extent_info(trans, root,7528 ret = btrfs_lookup_extent_info(trans, root,
7528 path->nodes[level]->start,7529 path->nodes[level]->start,
@@ -7538,6 +7539,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, · 9 unmodified lines
7538 break;7539 break;
7539 7540
7540 btrfs_tree_unlock(path->nodes[level]);7541 btrfs_tree_unlock(path->nodes[level]);
7542 path->locks[level] = 0;
7541 WARN_ON(wc->refs[level] != 1);7543 WARN_ON(wc->refs[level] != 1);
7542 level--;7544 level--;
7543 }7545 }