2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-11-20 08:38:24 +08:00

Btrfs: Make sure to cow the root during a snapshot

Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
Chris Mason 2007-08-27 16:49:44 -04:00 committed by David Woodhouse
parent 2cc58cf24f
commit 83df7c1d8b

View File

@ -2096,6 +2096,7 @@ static int create_snapshot(struct btrfs_root *root, char *name, int namelen)
struct btrfs_trans_handle *trans;
struct btrfs_key key;
struct btrfs_root_item new_root_item;
struct buffer_head *tmp;
int ret;
int err;
u64 objectid;
@ -2123,6 +2124,7 @@ static int create_snapshot(struct btrfs_root *root, char *name, int namelen)
key.offset = 1;
key.flags = 0;
btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY);
btrfs_cow_block(trans, root, root->node, NULL, 0, &tmp);
btrfs_set_root_blocknr(&new_root_item, bh_blocknr(root->node));
ret = btrfs_insert_root(trans, root->fs_info->tree_root, &key,