* [PATCH] Btrfs: fix lock leak when resuming snapshot deletion
@ 2013-07-15 16:43 Josef Bacik
2013-07-16 14:54 ` Alex Lyakas
0 siblings, 1 reply; 2+ messages in thread
From: Josef Bacik @ 2013-07-15 16:43 UTC (permalink / raw)
To: linux-btrfs
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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] Btrfs: fix lock leak when resuming snapshot deletion
2013-07-15 16:43 [PATCH] Btrfs: fix lock leak when resuming snapshot deletion Josef Bacik
@ 2013-07-16 14:54 ` Alex Lyakas
0 siblings, 0 replies; 2+ messages in thread
From: Alex Lyakas @ 2013-07-16 14:54 UTC (permalink / raw)
To: Josef Bacik; +Cc: linux-btrfs, Liran Strugano
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-07-16 14:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-15 16:43 [PATCH] Btrfs: fix lock leak when resuming snapshot deletion Josef Bacik
2013-07-16 14:54 ` Alex Lyakas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).