Skip to contentSkip to conversation

Btrfs: fix unprotected extent map operation when logging file extents

PATCH In review Miao Xie 2 participants 2 messages Nov 1, 2012 Btrfs file system

lore
Share & tools
lore

Miao Xie

author
#0 lore raw

PATCH 4/5 Btrfs: fix unprotected extent map operation when logging file extents

We forget to protect the modified_extents list, fix it.

---
 fs/btrfs/tree-log.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
fs/btrfs/tree-log.c +2 -0
index cbb544e..f7e9387 100644
@@ -3525,8 +3525,10 @@ next_slot:
 		struct extent_map_tree *tree = &BTRFS_I(inode)->extent_tree;
 		struct extent_map *em, *n;
 
+		write_lock(&tree->lock);
 		list_for_each_entry_safe(em, n, &tree->modified_extents, list)
 			list_del_init(&em->list);
+		write_unlock(&tree->lock);
 	}
 
 	if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) {
Signature · 1 line
1.7.6.5
Reviewed-by on v1 4/5
#1 lore raw
Quoted 2 lines · Miao Xie

We forget to protect the modified_extents list, fix it.

Looks good to me.

thanks,
liubo

Quoted 26 lines
---
 fs/btrfs/tree-log.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
fs/btrfs/tree-log.c +2 -0
index cbb544e..f7e9387 100644
@@ -3525,8 +3525,10 @@ next_slot:
 		struct extent_map_tree *tree = &BTRFS_I(inode)->extent_tree;
 		struct extent_map *em, *n;
 
+		write_lock(&tree->lock);
 		list_for_each_entry_safe(em, n, &tree->modified_extents, list)
 			list_del_init(&em->list);
+		write_unlock(&tree->lock);
 	}
 
 	if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) {
Signature · 5 lines
1.7.6.5
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html