Commit 03c751a5e10caafbb6d1afcaf1ea67f2153c3193

Authored by Linus Torvalds

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

Pull btrfs fixes from Chris Mason:
 "None of these are huge, but my commit does fix a regression from 3.18
  that could cause lost files during log replay.

  This also adds Dave Sterba to the list of Btrfs maintainers.  It
  doesn't mean we're doing things differently, but Dave has really been
  helping with the maintainer workload for years"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  Btrfs: don't delay inode ref updates during log replay
  Btrfs: correctly get tree level in tree_backref_for_extent
  Btrfs: call inode_dec_link_count() on mkdir error path
  Btrfs: abort transaction if we don't find the block group
  Btrfs, scrub: uninitialized variable in scrub_extent_for_parity()
  Btrfs: add more maintainers

Showing 6 changed files Side-by-side Diff

... ... @@ -2259,6 +2259,7 @@
2259 2259 BTRFS FILE SYSTEM
2260 2260 M: Chris Mason <clm@fb.com>
2261 2261 M: Josef Bacik <jbacik@fb.com>
  2262 +M: David Sterba <dsterba@suse.cz>
2262 2263 L: linux-btrfs@vger.kernel.org
2263 2264 W: http://btrfs.wiki.kernel.org/
2264 2265 Q: http://patchwork.kernel.org/project/linux-btrfs/list/
... ... @@ -1552,7 +1552,6 @@
1552 1552 {
1553 1553 int ret;
1554 1554 int type;
1555   - struct btrfs_tree_block_info *info;
1556 1555 struct btrfs_extent_inline_ref *eiref;
1557 1556  
1558 1557 if (*ptr == (unsigned long)-1)
1559 1558  
... ... @@ -1573,9 +1572,17 @@
1573 1572 }
1574 1573  
1575 1574 /* we can treat both ref types equally here */
1576   - info = (struct btrfs_tree_block_info *)(ei + 1);
1577 1575 *out_root = btrfs_extent_inline_ref_offset(eb, eiref);
1578   - *out_level = btrfs_tree_block_level(eb, info);
  1576 +
  1577 + if (key->type == BTRFS_EXTENT_ITEM_KEY) {
  1578 + struct btrfs_tree_block_info *info;
  1579 +
  1580 + info = (struct btrfs_tree_block_info *)(ei + 1);
  1581 + *out_level = btrfs_tree_block_level(eb, info);
  1582 + } else {
  1583 + ASSERT(key->type == BTRFS_METADATA_ITEM_KEY);
  1584 + *out_level = (u8)key->offset;
  1585 + }
1579 1586  
1580 1587 if (ret == 1)
1581 1588 *ptr = (unsigned long)-1;
fs/btrfs/delayed-inode.c
... ... @@ -1857,6 +1857,14 @@
1857 1857 {
1858 1858 struct btrfs_delayed_node *delayed_node;
1859 1859  
  1860 + /*
  1861 + * we don't do delayed inode updates during log recovery because it
  1862 + * leads to enospc problems. This means we also can't do
  1863 + * delayed inode refs
  1864 + */
  1865 + if (BTRFS_I(inode)->root->fs_info->log_root_recovering)
  1866 + return -EAGAIN;
  1867 +
1860 1868 delayed_node = btrfs_get_or_create_delayed_node(inode);
1861 1869 if (IS_ERR(delayed_node))
1862 1870 return PTR_ERR(delayed_node);
fs/btrfs/extent-tree.c
... ... @@ -3139,9 +3139,11 @@
3139 3139 struct extent_buffer *leaf;
3140 3140  
3141 3141 ret = btrfs_search_slot(trans, extent_root, &cache->key, path, 0, 1);
3142   - if (ret < 0)
  3142 + if (ret) {
  3143 + if (ret > 0)
  3144 + ret = -ENOENT;
3143 3145 goto fail;
3144   - BUG_ON(ret); /* Corruption */
  3146 + }
3145 3147  
3146 3148 leaf = path->nodes[0];
3147 3149 bi = btrfs_item_ptr_offset(leaf, path->slots[0]);
3148 3150  
... ... @@ -3149,11 +3151,9 @@
3149 3151 btrfs_mark_buffer_dirty(leaf);
3150 3152 btrfs_release_path(path);
3151 3153 fail:
3152   - if (ret) {
  3154 + if (ret)
3153 3155 btrfs_abort_transaction(trans, root, ret);
3154   - return ret;
3155   - }
3156   - return 0;
  3156 + return ret;
3157 3157  
3158 3158 }
3159 3159  
... ... @@ -6255,8 +6255,10 @@
6255 6255  
6256 6256 out_fail:
6257 6257 btrfs_end_transaction(trans, root);
6258   - if (drop_on_err)
  6258 + if (drop_on_err) {
  6259 + inode_dec_link_count(inode);
6259 6260 iput(inode);
  6261 + }
6260 6262 btrfs_balance_delayed_items(root);
6261 6263 btrfs_btree_balance_dirty(root);
6262 6264 return err;
... ... @@ -2607,9 +2607,9 @@
2607 2607 ret = scrub_pages_for_parity(sparity, logical, l, physical, dev,
2608 2608 flags, gen, mirror_num,
2609 2609 have_csum ? csum : NULL);
2610   -skip:
2611 2610 if (ret)
2612 2611 return ret;
  2612 +skip:
2613 2613 len -= l;
2614 2614 logical += l;
2615 2615 physical += l;