History

Merge branch 'for-linus-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs

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()

Linus Torvalds committed 11 years ago

Commit acea5682 parents c6fd4fc 00d80e34 files · +23 −3Browse files

Unified · Split

4 files
  1. fs/btrfs/dev-replace.c +1 −1
  2. fs/btrfs/disk-io.c +2 −1
  3. fs/btrfs/extent-tree.c +18 −0
  4. fs/btrfs/transaction.c +2 −1
fs/btrfs/dev-replace.c+1−1
@@ -378,7 +378,7 @@ int btrfs_dev_replace_start(struct btrfs_root *root, · 377 unmodified lines
378378
379379 ret = btrfs_kobj_add_device(tgt_device->fs_devices, tgt_device);
380380 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);
382382
383383 printk_in_rcu(KERN_INFO
384384 "BTRFS: dev_replace from %s (devid %llu) to %s started\n",
fs/btrfs/disk-io.c+2−1
@@ -2842,6 +2842,7 @@ int open_ctree(struct super_block *sb, · 2841 unmodified lines
28422842 !extent_buffer_uptodate(chunk_root->node)) {
28432843 printk(KERN_ERR "BTRFS: failed to read chunk root on %s\n",
28442844 sb->s_id);
2845+ chunk_root->node = NULL;
28452846 goto fail_tree_roots;
28462847 }
28472848 btrfs_set_root_node(&chunk_root->root_item, chunk_root->node);
@@ -2879,7 +2880,7 @@ retry_root_backup: · 31 unmodified lines
28792880 !extent_buffer_uptodate(tree_root->node)) {
28802881 printk(KERN_WARNING "BTRFS: failed to read tree root on %s\n",
28812882 sb->s_id);
2882−
2883+ tree_root->node = NULL;
28832884 goto recovery_tree_root;
28842885 }
28852886
fs/btrfs/extent-tree.c+18−0
@@ -4227,6 +4227,24 @@ out: · 4226 unmodified lines
42274227 space_info->chunk_alloc = 0;
42284228 spin_unlock(&space_info->lock);
42294229 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+ }
42304248 return ret;
42314249 }
42324250
fs/btrfs/transaction.c+2−1
@@ -2152,7 +2152,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, · 2151 unmodified lines
21522152
21532153 kmem_cache_free(btrfs_trans_handle_cachep, trans);
21542154
2155− if (current != root->fs_info->transaction_kthread)
2155+ if (current != root->fs_info->transaction_kthread &&
2156+ current != root->fs_info->cleaner_kthread)
21562157 btrfs_run_delayed_iputs(root);
21572158
21582159 return ret;