aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-04-25 13:44:38 -0400
committerJosef Bacik <jbacik@fusionio.com>2013-05-06 15:55:11 -0400
commit54067ae95e1547123fe6ffcf80842e234effd53b (patch)
tree4a3b4feab80ba27cac0a176e60b81f73d17a655b /fs
parentfd8b2b611580929ab1aa01e3942dce20f9e95732 (diff)
Btrfs: various abort cleanups
I have a broken file system that when it aborts leaves all sorts of accounting things wrong and gives you lots of WARN_ON()'s other than the abort. This is because we're not cleaning up various parts of the file system when we abort. The first chunks are specific to mount failures, we weren't cleaning up the block group cached inodes and we weren't cleaning up any transactions that had been aborted, which leaves a bunch of things laying around. The second half of this are related to the cleanup parts. First we don't need to release space for the dirty pages from the trans_block_rsv, that's all handled by the trans handles so this is just plain wrong. The other thing is we need to pin down extents that were set ->must_insert_reserved for delayed refs. This isn't so much for the pinning but more for the cleaning up the cache->reserved counter since we are no longer going to use those reserved bytes. With this patch I no longer see a bunch of WARN_ON()'s when I try to mount this broken file system, just the initial one from the abort. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/disk-io.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index aff571cb6e04..84c4fa503ef5 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2826,6 +2826,7 @@ fail_qgroup:
2826fail_trans_kthread: 2826fail_trans_kthread:
2827 kthread_stop(fs_info->transaction_kthread); 2827 kthread_stop(fs_info->transaction_kthread);
2828 del_fs_roots(fs_info); 2828 del_fs_roots(fs_info);
2829 btrfs_cleanup_transaction(fs_info->tree_root);
2829fail_cleaner: 2830fail_cleaner:
2830 kthread_stop(fs_info->cleaner_kthread); 2831 kthread_stop(fs_info->cleaner_kthread);
2831 2832
@@ -2836,6 +2837,7 @@ fail_cleaner:
2836 filemap_write_and_wait(fs_info->btree_inode->i_mapping); 2837 filemap_write_and_wait(fs_info->btree_inode->i_mapping);
2837 2838
2838fail_block_groups: 2839fail_block_groups:
2840 btrfs_put_block_group_cache(fs_info);
2839 btrfs_free_block_groups(fs_info); 2841 btrfs_free_block_groups(fs_info);
2840 2842
2841fail_tree_roots: 2843fail_tree_roots:
@@ -3681,6 +3683,9 @@ int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
3681 continue; 3683 continue;
3682 } 3684 }
3683 3685
3686 if (head->must_insert_reserved)
3687 btrfs_pin_extent(root, ref->bytenr,
3688 ref->num_bytes, 1);
3684 btrfs_free_delayed_extent_op(head->extent_op); 3689 btrfs_free_delayed_extent_op(head->extent_op);
3685 delayed_refs->num_heads--; 3690 delayed_refs->num_heads--;
3686 if (list_empty(&head->cluster)) 3691 if (list_empty(&head->cluster))
@@ -3876,10 +3881,6 @@ int btrfs_cleanup_transaction(struct btrfs_root *root)
3876 3881
3877 btrfs_destroy_delayed_refs(t, root); 3882 btrfs_destroy_delayed_refs(t, root);
3878 3883
3879 btrfs_block_rsv_release(root,
3880 &root->fs_info->trans_block_rsv,
3881 t->dirty_pages.dirty_bytes);
3882
3883 /* FIXME: cleanup wait for commit */ 3884 /* FIXME: cleanup wait for commit */
3884 t->in_commit = 1; 3885 t->in_commit = 1;
3885 t->blocked = 1; 3886 t->blocked = 1;