Message ID | 1373906586-3271-1-git-send-email-jbacik@fusionio.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
On Mon, Jul 15, 2013 at 7:43 PM, Josef Bacik <jbacik@fusionio.com> wrote: > 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> > --- > 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 8c204e1..997a5dd 100644 > --- a/fs/btrfs/extent-tree.c > +++ b/fs/btrfs/extent-tree.c > @@ -7555,6 +7555,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, > @@ -7570,6 +7571,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--; > } > -- > 1.7.7.6 > > -- Tested-by: Liran Strugano <liran@zadarastorage.com> > To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 8c204e1..997a5dd 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -7555,6 +7555,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, @@ -7570,6 +7571,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--; }
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> --- fs/btrfs/extent-tree.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)