diff options
author | Mark Fasheh <mfasheh@suse.com> | 2011-08-29 17:17:04 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2012-03-21 20:45:37 -0400 |
commit | e5df957328b18baa731307c66cfe8e7a4981df65 (patch) | |
tree | 19f092c1e65c639c17a2fc0582d01b0ebfb3e3a7 /fs/btrfs/ctree.c | |
parent | 4ed1d16e944c61cfb8a78159548672e7df168d97 (diff) |
btrfs: Go readonly on bad extent refs in update_ref_for_cow()
update_ref_for_cow() will BUG_ON() after it's call to
btrfs_lookup_extent_info() if no existing references are found. Since refs
are computed directly from disk, this should be treated as a corruption
instead of a logic error.
Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r-- | fs/btrfs/ctree.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index e2e43c07f6b1..3b767d2b68e8 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -333,7 +333,11 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans, | |||
333 | buf->len, &refs, &flags); | 333 | buf->len, &refs, &flags); |
334 | if (ret) | 334 | if (ret) |
335 | return ret; | 335 | return ret; |
336 | BUG_ON(refs == 0); | 336 | if (refs == 0) { |
337 | ret = -EROFS; | ||
338 | btrfs_std_error(root->fs_info, ret); | ||
339 | return ret; | ||
340 | } | ||
337 | } else { | 341 | } else { |
338 | refs = 1; | 342 | refs = 1; |
339 | if (root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID || | 343 | if (root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID || |