Pull btrfs fixes from Chris Mason: "Filipe fixed up a hard to trigger ENOSPC regression from our merge window pull, and we have a few other smaller fixes" * 'for-linus-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: Btrfs: fix quick exhaustion of the system array in the superblock btrfs: its btrfs_err() instead of btrfs_error() btrfs: Avoid NULL pointer dereference of free_extent_buffer when read_tree_block() fail btrfs: Fix lockdep warning of btrfs_run_delayed_iputs()
Unified · Split
| @@ -378,7 +378,7 @@ int btrfs_dev_replace_start(struct btrfs_root *root, · 377 unmodified lines | |||
| 378 | 378 | ||
| 379 | ret = btrfs_kobj_add_device(tgt_device->fs_devices, tgt_device); | 379 | ret = btrfs_kobj_add_device(tgt_device->fs_devices, tgt_device); |
| 380 | if (ret) | 380 | if (ret) |
| 381 | btrfs_error(root->fs_info, ret, "kobj add dev failed"); | 381 | btrfs_err(root->fs_info, "kobj add dev failed %d\n", ret); |
| 382 | 382 | ||
| 383 | printk_in_rcu(KERN_INFO | 383 | printk_in_rcu(KERN_INFO |
| 384 | "BTRFS: dev_replace from %s (devid %llu) to %s started\n", | 384 | "BTRFS: dev_replace from %s (devid %llu) to %s started\n", |
| @@ -2842,6 +2842,7 @@ int open_ctree(struct super_block *sb, · 2841 unmodified lines | |||
| 2842 | !extent_buffer_uptodate(chunk_root->node)) { | 2842 | !extent_buffer_uptodate(chunk_root->node)) { |
| 2843 | printk(KERN_ERR "BTRFS: failed to read chunk root on %s\n", | 2843 | printk(KERN_ERR "BTRFS: failed to read chunk root on %s\n", |
| 2844 | sb->s_id); | 2844 | sb->s_id); |
| 2845 | chunk_root->node = NULL; | ||
| 2845 | goto fail_tree_roots; | 2846 | goto fail_tree_roots; |
| 2846 | } | 2847 | } |
| 2847 | btrfs_set_root_node(&chunk_root->root_item, chunk_root->node); | 2848 | btrfs_set_root_node(&chunk_root->root_item, chunk_root->node); |
| @@ -2879,7 +2880,7 @@ retry_root_backup: · 31 unmodified lines | |||
| 2879 | !extent_buffer_uptodate(tree_root->node)) { | 2880 | !extent_buffer_uptodate(tree_root->node)) { |
| 2880 | printk(KERN_WARNING "BTRFS: failed to read tree root on %s\n", | 2881 | printk(KERN_WARNING "BTRFS: failed to read tree root on %s\n", |
| 2881 | sb->s_id); | 2882 | sb->s_id); |
| 2882 | 2883 | tree_root->node = NULL; | |
| 2883 | goto recovery_tree_root; | 2884 | goto recovery_tree_root; |
| 2884 | } | 2885 | } |
| 2885 | 2886 | ||
| @@ -4227,6 +4227,24 @@ out: · 4226 unmodified lines | |||
| 4227 | space_info->chunk_alloc = 0; | 4227 | space_info->chunk_alloc = 0; |
| 4228 | spin_unlock(&space_info->lock); | 4228 | spin_unlock(&space_info->lock); |
| 4229 | mutex_unlock(&fs_info->chunk_mutex); | 4229 | mutex_unlock(&fs_info->chunk_mutex); |
| 4230 | /* | ||
| 4231 | * When we allocate a new chunk we reserve space in the chunk block | ||
| 4232 | * reserve to make sure we can COW nodes/leafs in the chunk tree or | ||
| 4233 | * add new nodes/leafs to it if we end up needing to do it when | ||
| 4234 | * inserting the chunk item and updating device items as part of the | ||
| 4235 | * second phase of chunk allocation, performed by | ||
| 4236 | * btrfs_finish_chunk_alloc(). So make sure we don't accumulate a | ||
| 4237 | * large number of new block groups to create in our transaction | ||
| 4238 | * handle's new_bgs list to avoid exhausting the chunk block reserve | ||
| 4239 | * in extreme cases - like having a single transaction create many new | ||
| 4240 | * block groups when starting to write out the free space caches of all | ||
| 4241 | * the block groups that were made dirty during the lifetime of the | ||
| 4242 | * transaction. | ||
| 4243 | */ | ||
| 4244 | if (trans->chunk_bytes_reserved >= (2 * 1024 * 1024ull)) { | ||
| 4245 | btrfs_create_pending_block_groups(trans, trans->root); | ||
| 4246 | btrfs_trans_release_chunk_metadata(trans); | ||
| 4247 | } | ||
| 4230 | return ret; | 4248 | return ret; |
| 4231 | } | 4249 | } |
| 4232 | 4250 | ||
| @@ -2152,7 +2152,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, · 2151 unmodified lines | |||
| 2152 | 2152 | ||
| 2153 | kmem_cache_free(btrfs_trans_handle_cachep, trans); | 2153 | kmem_cache_free(btrfs_trans_handle_cachep, trans); |
| 2154 | 2154 | ||
| 2155 | if (current != root->fs_info->transaction_kthread) | 2155 | if (current != root->fs_info->transaction_kthread && |
| 2156 | current != root->fs_info->cleaner_kthread) | ||
| 2156 | btrfs_run_delayed_iputs(root); | 2157 | btrfs_run_delayed_iputs(root); |
| 2157 | 2158 | ||
| 2158 | return ret; | 2159 | return ret; |