[Btrfs-devel][PATCH]Fix buffer get/release issue in create_snapshot
Yan Zheng
yanzheng at 21cn.com
Tue Dec 4 05:22:44 PST 2007
Hello,
'__btrfs_cow_block' expects the caller holds a reference to the buffer
and it drops caller's reference. If the caller doesn't hold a
reference, root->commit_root's reference may lose.
Regards
YZ
diff -r 66ea50b1a761 inode.c
--- a/inode.c Tue Nov 20 13:44:45 2007 -0500
+++ b/inode.c Tue Dec 04 18:32:38 2007 +0800
@@ -2035,7 +2035,9 @@ static int create_snapshot(struct btrfs_
key.offset = 1;
btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY);
+ extent_buffer_get(root->node);
btrfs_cow_block(trans, root, root->node, NULL, 0, &tmp);
+ free_extent_buffer(&tmp);
btrfs_set_root_bytenr(&new_root_item, root->node->start);
btrfs_set_root_level(&new_root_item, btrfs_header_level(root->node));
More information about the Btrfs-devel
mailing list