diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2013-03-04 11:25:40 -0500 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-03-04 16:33:23 -0500 |
commit | 0f788c58194e4ccc5b3ab23f872c5e18542335e4 (patch) | |
tree | 5e950eb614b23cef93e0348e94ed3e65ff1abe64 /fs/btrfs | |
parent | 288189471d7e12fb22c37870e151833f438deea8 (diff) |
Btrfs: do not BUG_ON on aborted situation
Btrfs balance can easily hit BUG_ON in these places, but we want
to it bail out gracefully after we force the whole filesystem to
readonly. So we use btrfs_std_error hook in place of BUG_ON.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/relocation.c | 6 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 9d13786eec73..3ebe87977aae 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -3771,7 +3771,11 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) | |||
3771 | while (1) { | 3771 | while (1) { |
3772 | progress++; | 3772 | progress++; |
3773 | trans = btrfs_start_transaction(rc->extent_root, 0); | 3773 | trans = btrfs_start_transaction(rc->extent_root, 0); |
3774 | BUG_ON(IS_ERR(trans)); | 3774 | if (IS_ERR(trans)) { |
3775 | err = PTR_ERR(trans); | ||
3776 | trans = NULL; | ||
3777 | break; | ||
3778 | } | ||
3775 | restart: | 3779 | restart: |
3776 | if (update_backref_cache(trans, &rc->backref_cache)) { | 3780 | if (update_backref_cache(trans, &rc->backref_cache)) { |
3777 | btrfs_end_transaction(trans, rc->extent_root); | 3781 | btrfs_end_transaction(trans, rc->extent_root); |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 35bb2d4ed29f..9ff454df6756 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -2379,7 +2379,11 @@ static int btrfs_relocate_chunk(struct btrfs_root *root, | |||
2379 | return ret; | 2379 | return ret; |
2380 | 2380 | ||
2381 | trans = btrfs_start_transaction(root, 0); | 2381 | trans = btrfs_start_transaction(root, 0); |
2382 | BUG_ON(IS_ERR(trans)); | 2382 | if (IS_ERR(trans)) { |
2383 | ret = PTR_ERR(trans); | ||
2384 | btrfs_std_error(root->fs_info, ret); | ||
2385 | return ret; | ||
2386 | } | ||
2383 | 2387 | ||
2384 | lock_chunks(root); | 2388 | lock_chunks(root); |
2385 | 2389 | ||
@@ -3050,7 +3054,8 @@ static void __cancel_balance(struct btrfs_fs_info *fs_info) | |||
3050 | 3054 | ||
3051 | unset_balance_control(fs_info); | 3055 | unset_balance_control(fs_info); |
3052 | ret = del_balance_item(fs_info->tree_root); | 3056 | ret = del_balance_item(fs_info->tree_root); |
3053 | BUG_ON(ret); | 3057 | if (ret) |
3058 | btrfs_std_error(fs_info, ret); | ||
3054 | 3059 | ||
3055 | atomic_set(&fs_info->mutually_exclusive_operation_running, 0); | 3060 | atomic_set(&fs_info->mutually_exclusive_operation_running, 0); |
3056 | } | 3061 | } |