diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2011-11-10 20:45:04 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-11-10 20:45:04 -0500 |
commit | 924cd8fbe41851eda2b68bf2ed501b2777fd77b4 (patch) | |
tree | c31afbc9ba7dbc27eea43a0319a64732d180a3d2 /fs/btrfs | |
parent | f7d572188b7b2a6d07081688f8602dc407186e64 (diff) | |
download | linux-stable-924cd8fbe41851eda2b68bf2ed501b2777fd77b4.tar.gz linux-stable-924cd8fbe41851eda2b68bf2ed501b2777fd77b4.tar.bz2 linux-stable-924cd8fbe41851eda2b68bf2ed501b2777fd77b4.zip |
Btrfs: fix nocow when deleting the item
btrfs_previous_item() just search the b+ tree, do not COW the nodes or leaves,
if we modify the result of it, the meta-data will be broken. fix it.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/volumes.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index f8e2943101a1..c37433d3cd82 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -999,7 +999,7 @@ static int btrfs_free_dev_extent(struct btrfs_trans_handle *trans, key.objectid = device->devid; key.offset = start; key.type = BTRFS_DEV_EXTENT_KEY; - +again: ret = btrfs_search_slot(trans, root, &key, path, -1, 1); if (ret > 0) { ret = btrfs_previous_item(root, path, key.objectid, @@ -1012,6 +1012,9 @@ static int btrfs_free_dev_extent(struct btrfs_trans_handle *trans, struct btrfs_dev_extent); BUG_ON(found_key.offset > start || found_key.offset + btrfs_dev_extent_length(leaf, extent) < start); + key = found_key; + btrfs_release_path(path); + goto again; } else if (ret == 0) { leaf = path->nodes[0]; extent = btrfs_item_ptr(leaf, path->slots[0], |