From: Mark Fasheh Date: Mon, 29 Aug 2011 21:30:39 +0000 (-0700) Subject: btrfs: Don't BUG_ON errors from update_ref_for_cow() X-Git-Tag: v3.4-rc3~11^2~20^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b68dc2a93e794c8507338c91577a277efa4555d5;p=platform%2Fkernel%2Flinux-stable.git btrfs: Don't BUG_ON errors from update_ref_for_cow() __btrfs_cow_block(), the only caller of update_ref_for_cow() will BUG_ON() any error return. Instead, we can go read-only fs as update_ref_for_cow() manipulates disk data in a way which doesn't look like it's easily rolled back. Signed-off-by: Mark Fasheh --- diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 3b767d2..36e16bd 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -474,7 +474,10 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, BTRFS_FSID_SIZE); ret = update_ref_for_cow(trans, root, buf, cow, &last_ref); - BUG_ON(ret); + if (ret) { + btrfs_std_error(root->fs_info, ret); + return ret; + } if (root->ref_cows) btrfs_reloc_cow_block(trans, root, buf, cow);