diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-08-27 16:49:44 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-08-27 16:49:44 -0400 |
commit | 83df7c1d8b885e216c68c3f0469bec9b93666b74 (patch) | |
tree | ad8b3373c86c36f9c690def7f71724401ffb41fe /fs/btrfs/inode.c | |
parent | 2cc58cf24f69be8632a3b29d653c318bf3bd8c84 (diff) |
Btrfs: Make sure to cow the root during a snapshot
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 7e4cf62ada5a..504d37dfa6c9 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -2096,6 +2096,7 @@ static int create_snapshot(struct btrfs_root *root, char *name, int namelen) | |||
2096 | struct btrfs_trans_handle *trans; | 2096 | struct btrfs_trans_handle *trans; |
2097 | struct btrfs_key key; | 2097 | struct btrfs_key key; |
2098 | struct btrfs_root_item new_root_item; | 2098 | struct btrfs_root_item new_root_item; |
2099 | struct buffer_head *tmp; | ||
2099 | int ret; | 2100 | int ret; |
2100 | int err; | 2101 | int err; |
2101 | u64 objectid; | 2102 | u64 objectid; |
@@ -2123,6 +2124,7 @@ static int create_snapshot(struct btrfs_root *root, char *name, int namelen) | |||
2123 | key.offset = 1; | 2124 | key.offset = 1; |
2124 | key.flags = 0; | 2125 | key.flags = 0; |
2125 | btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY); | 2126 | btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY); |
2127 | btrfs_cow_block(trans, root, root->node, NULL, 0, &tmp); | ||
2126 | btrfs_set_root_blocknr(&new_root_item, bh_blocknr(root->node)); | 2128 | btrfs_set_root_blocknr(&new_root_item, bh_blocknr(root->node)); |
2127 | 2129 | ||
2128 | ret = btrfs_insert_root(trans, root->fs_info->tree_root, &key, | 2130 | ret = btrfs_insert_root(trans, root->fs_info->tree_root, &key, |