diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-06-14 01:34:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-06-14 01:34:14 -0400 |
commit | a2648ebb7ed69ef209d9c8a76fadeb3252d9a023 (patch) | |
tree | 9a8e75db208395b8de1a2e6e5045abf56e8677a0 /fs | |
parent | 33c929c06eb4a483a3e4ffbff58f6e4f31ae4565 (diff) | |
parent | 13e6c37b989859e70b0d73d3f2cb0aa022159b17 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull btrfs fixes from Chris Mason:
"This is an assortment of crash fixes"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
Btrfs: stop all workers before cleaning up roots
Btrfs: fix use-after-free bug during umount
Btrfs: init relocate extent_io_tree with a mapping
btrfs: Drop inode if inode root is NULL
Btrfs: don't delete fs_roots until after we cleanup the transaction
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/disk-io.c | 10 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 3 | ||||
-rw-r--r-- | fs/btrfs/relocation.c | 9 |
3 files changed, 13 insertions, 9 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index e7b3cb5286a5..b8b60b660c8f 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -2859,8 +2859,8 @@ fail_qgroup: | |||
2859 | btrfs_free_qgroup_config(fs_info); | 2859 | btrfs_free_qgroup_config(fs_info); |
2860 | fail_trans_kthread: | 2860 | fail_trans_kthread: |
2861 | kthread_stop(fs_info->transaction_kthread); | 2861 | kthread_stop(fs_info->transaction_kthread); |
2862 | del_fs_roots(fs_info); | ||
2863 | btrfs_cleanup_transaction(fs_info->tree_root); | 2862 | btrfs_cleanup_transaction(fs_info->tree_root); |
2863 | del_fs_roots(fs_info); | ||
2864 | fail_cleaner: | 2864 | fail_cleaner: |
2865 | kthread_stop(fs_info->cleaner_kthread); | 2865 | kthread_stop(fs_info->cleaner_kthread); |
2866 | 2866 | ||
@@ -3512,15 +3512,15 @@ int close_ctree(struct btrfs_root *root) | |||
3512 | percpu_counter_sum(&fs_info->delalloc_bytes)); | 3512 | percpu_counter_sum(&fs_info->delalloc_bytes)); |
3513 | } | 3513 | } |
3514 | 3514 | ||
3515 | free_root_pointers(fs_info, 1); | ||
3516 | |||
3517 | btrfs_free_block_groups(fs_info); | 3515 | btrfs_free_block_groups(fs_info); |
3518 | 3516 | ||
3517 | btrfs_stop_all_workers(fs_info); | ||
3518 | |||
3519 | del_fs_roots(fs_info); | 3519 | del_fs_roots(fs_info); |
3520 | 3520 | ||
3521 | iput(fs_info->btree_inode); | 3521 | free_root_pointers(fs_info, 1); |
3522 | 3522 | ||
3523 | btrfs_stop_all_workers(fs_info); | 3523 | iput(fs_info->btree_inode); |
3524 | 3524 | ||
3525 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY | 3525 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY |
3526 | if (btrfs_test_opt(root, CHECK_INTEGRITY)) | 3526 | if (btrfs_test_opt(root, CHECK_INTEGRITY)) |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index af978f7682b3..17f3064b4a3e 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -8012,6 +8012,9 @@ int btrfs_drop_inode(struct inode *inode) | |||
8012 | { | 8012 | { |
8013 | struct btrfs_root *root = BTRFS_I(inode)->root; | 8013 | struct btrfs_root *root = BTRFS_I(inode)->root; |
8014 | 8014 | ||
8015 | if (root == NULL) | ||
8016 | return 1; | ||
8017 | |||
8015 | /* the snap/subvol tree is on deleting */ | 8018 | /* the snap/subvol tree is on deleting */ |
8016 | if (btrfs_root_refs(&root->root_item) == 0 && | 8019 | if (btrfs_root_refs(&root->root_item) == 0 && |
8017 | root != root->fs_info->tree_root) | 8020 | root != root->fs_info->tree_root) |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 395b82031a42..4febca4fc2de 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -4082,7 +4082,7 @@ out: | |||
4082 | return inode; | 4082 | return inode; |
4083 | } | 4083 | } |
4084 | 4084 | ||
4085 | static struct reloc_control *alloc_reloc_control(void) | 4085 | static struct reloc_control *alloc_reloc_control(struct btrfs_fs_info *fs_info) |
4086 | { | 4086 | { |
4087 | struct reloc_control *rc; | 4087 | struct reloc_control *rc; |
4088 | 4088 | ||
@@ -4093,7 +4093,8 @@ static struct reloc_control *alloc_reloc_control(void) | |||
4093 | INIT_LIST_HEAD(&rc->reloc_roots); | 4093 | INIT_LIST_HEAD(&rc->reloc_roots); |
4094 | backref_cache_init(&rc->backref_cache); | 4094 | backref_cache_init(&rc->backref_cache); |
4095 | mapping_tree_init(&rc->reloc_root_tree); | 4095 | mapping_tree_init(&rc->reloc_root_tree); |
4096 | extent_io_tree_init(&rc->processed_blocks, NULL); | 4096 | extent_io_tree_init(&rc->processed_blocks, |
4097 | fs_info->btree_inode->i_mapping); | ||
4097 | return rc; | 4098 | return rc; |
4098 | } | 4099 | } |
4099 | 4100 | ||
@@ -4110,7 +4111,7 @@ int btrfs_relocate_block_group(struct btrfs_root *extent_root, u64 group_start) | |||
4110 | int rw = 0; | 4111 | int rw = 0; |
4111 | int err = 0; | 4112 | int err = 0; |
4112 | 4113 | ||
4113 | rc = alloc_reloc_control(); | 4114 | rc = alloc_reloc_control(fs_info); |
4114 | if (!rc) | 4115 | if (!rc) |
4115 | return -ENOMEM; | 4116 | return -ENOMEM; |
4116 | 4117 | ||
@@ -4311,7 +4312,7 @@ int btrfs_recover_relocation(struct btrfs_root *root) | |||
4311 | if (list_empty(&reloc_roots)) | 4312 | if (list_empty(&reloc_roots)) |
4312 | goto out; | 4313 | goto out; |
4313 | 4314 | ||
4314 | rc = alloc_reloc_control(); | 4315 | rc = alloc_reloc_control(root->fs_info); |
4315 | if (!rc) { | 4316 | if (!rc) { |
4316 | err = -ENOMEM; | 4317 | err = -ENOMEM; |
4317 | goto out; | 4318 | goto out; |