aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorYan <yanzheng@21cn.com>2007-12-04 13:20:20 -0500
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:58 -0400
commit9691975dd663b255fa52404dc7de4b18892bf244 (patch)
treef0a413e147596191f2508767736923e15664760b /fs
parent1a2b2ac78a4151a49267a1e3f48a131f5810814e (diff)
Btrfs: Fix buffer get/release issue in create_snapshot
btrfs_cow_block expects a reference to be held on the buffer being cow'd. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 37f8e0321af8..d0af0807d9f8 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2034,11 +2034,11 @@ static int create_snapshot(struct btrfs_root *root, char *name, int namelen)
2034 key.objectid = objectid; 2034 key.objectid = objectid;
2035 key.offset = 1; 2035 key.offset = 1;
2036 btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY); 2036 btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY);
2037 2037 extent_buffer_get(root->node);
2038 btrfs_cow_block(trans, root, root->node, NULL, 0, &tmp); 2038 btrfs_cow_block(trans, root, root->node, NULL, 0, &tmp);
2039 free_extent_buffer(tmp);
2039 btrfs_set_root_bytenr(&new_root_item, root->node->start); 2040 btrfs_set_root_bytenr(&new_root_item, root->node->start);
2040 btrfs_set_root_level(&new_root_item, btrfs_header_level(root->node)); 2041 btrfs_set_root_level(&new_root_item, btrfs_header_level(root->node));
2041
2042 ret = btrfs_insert_root(trans, root->fs_info->tree_root, &key, 2042 ret = btrfs_insert_root(trans, root->fs_info->tree_root, &key,
2043 &new_root_item); 2043 &new_root_item);
2044 if (ret) 2044 if (ret)