diff options
author | Josef Bacik <jbacik@fusionio.com> | 2013-07-15 12:41:42 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-04 04:50:52 -0400 |
commit | 14e86565899d123a994d974560624b617d855ca8 (patch) | |
tree | 44c6a6ff5f39bef7099265a041cb89c1587e98ff /fs | |
parent | db60e49ae570b342d63f0bbda4d35b85a392da25 (diff) |
Btrfs: fix lock leak when resuming snapshot deletion
commit fec386ac1428f9c0e672df952cbca5cebd4e4e2f 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: Alex Lyakas <alex.btrfs@zadarastorage.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/extent-tree.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index df472ab1b5ac..3915155ba274 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -7355,6 +7355,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, | |||
7355 | while (1) { | 7355 | while (1) { |
7356 | btrfs_tree_lock(path->nodes[level]); | 7356 | btrfs_tree_lock(path->nodes[level]); |
7357 | btrfs_set_lock_blocking(path->nodes[level]); | 7357 | btrfs_set_lock_blocking(path->nodes[level]); |
7358 | path->locks[level] = BTRFS_WRITE_LOCK_BLOCKING; | ||
7358 | 7359 | ||
7359 | ret = btrfs_lookup_extent_info(trans, root, | 7360 | ret = btrfs_lookup_extent_info(trans, root, |
7360 | path->nodes[level]->start, | 7361 | path->nodes[level]->start, |
@@ -7370,6 +7371,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, | |||
7370 | break; | 7371 | break; |
7371 | 7372 | ||
7372 | btrfs_tree_unlock(path->nodes[level]); | 7373 | btrfs_tree_unlock(path->nodes[level]); |
7374 | path->locks[level] = 0; | ||
7373 | WARN_ON(wc->refs[level] != 1); | 7375 | WARN_ON(wc->refs[level] != 1); |
7374 | level--; | 7376 | level--; |
7375 | } | 7377 | } |