linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Prevent root_list corruption
@ 2012-04-24  5:11 Daniel J Blueman
  2012-04-24 13:17 ` Josef Bacik
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel J Blueman @ 2012-04-24  5:11 UTC (permalink / raw)
  To: linux-btrfs, Chris Mason; +Cc: Josef Bacik, Daniel J Blueman

I was seeing root_list corruption on unmount during fs resize in 3.4-rc4; add
correct locking to address this.

Signed-off-by: Daniel J Blueman <daniel@quora.org>
---
 fs/btrfs/relocation.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 017281d..5a105a0 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1279,7 +1279,9 @@ static int __update_reloc_root(struct btrfs_root *root, int del)
 		if (rb_node)
 			backref_tree_panic(rb_node, -EEXIST, node->bytenr);
 	} else {
+		spin_lock(&root->fs_info->trans_lock);
 		list_del_init(&root->root_list);
+		spin_unlock(&root->fs_info->trans_lock);
 		kfree(node);
 	}
 	return 0;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Prevent root_list corruption
  2012-04-24  5:11 [PATCH] Prevent root_list corruption Daniel J Blueman
@ 2012-04-24 13:17 ` Josef Bacik
  0 siblings, 0 replies; 2+ messages in thread
From: Josef Bacik @ 2012-04-24 13:17 UTC (permalink / raw)
  To: Daniel J Blueman; +Cc: linux-btrfs, Chris Mason, Josef Bacik

On Tue, Apr 24, 2012 at 01:11:40PM +0800, Daniel J Blueman wrote:
> I was seeing root_list corruption on unmount during fs resize in 3.4-rc4; add
> correct locking to address this.
> 
> Signed-off-by: Daniel J Blueman <daniel@quora.org>
> ---
>  fs/btrfs/relocation.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
> index 017281d..5a105a0 100644
> --- a/fs/btrfs/relocation.c
> +++ b/fs/btrfs/relocation.c
> @@ -1279,7 +1279,9 @@ static int __update_reloc_root(struct btrfs_root *root, int del)
>  		if (rb_node)
>  			backref_tree_panic(rb_node, -EEXIST, node->bytenr);
>  	} else {
> +		spin_lock(&root->fs_info->trans_lock);
>  		list_del_init(&root->root_list);
> +		spin_unlock(&root->fs_info->trans_lock);
>  		kfree(node);
>  	}
>  	return 0;
> -- 
> 1.7.9.5
> 

Reviewed-by: Josef Bacik <josef@redhat.com>

Thanks,

Josef

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-24 13:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-24  5:11 [PATCH] Prevent root_list corruption Daniel J Blueman
2012-04-24 13:17 ` Josef Bacik

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).