Skip to contentSkip to conversation

Prevent root_list corruption

PATCH In review Daniel J Blueman 2 participants 2 messages Apr 24, 2012 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Prevent root_list corruption

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

---
 fs/btrfs/relocation.c |    2 ++
 1 file changed, 2 insertions(+)
fs/btrfs/relocation.c +2 -0
index 017281d..5a105a0 100644
@@ -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;
Signature · 1 line
1.7.9.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 25 lines · Daniel J Blueman

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

---
 fs/btrfs/relocation.c |    2 ++
 1 file changed, 2 insertions(+)
fs/btrfs/relocation.c +2 -0
index 017281d..5a105a0 100644
@@ -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;
Signature · 1 line
1.7.9.5

Thanks,

Josef