Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fec386ac authored by Josef Bacik's avatar Josef Bacik
Browse files

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: stable@vger.kernel.org
Reported-by: default avatarAlex Lyakas <alex.btrfs@zadarastorage.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent 3c8f2422
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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,
@@ -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--;
		}