History

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

Linus Torvalds committed 11 years ago

Commit 03c751a2 parents b3d574a 6f896056 files · +29 −11Browse files

Unified · Split

6 files
  1. MAINTAINERS +1 −0
  2. fs/btrfs/backref.c +10 −3
  3. fs/btrfs/delayed-inode.c +8 −0
  4. fs/btrfs/extent-tree.c +6 −6
  5. fs/btrfs/inode.c +3 −1
  6. fs/btrfs/scrub.c +1 −1
MAINTAINERS+1−0
@@ -2259,6 +2259,7 @@ F: drivers/gpio/gpio-bt8xx.c · 2258 unmodified lines
22592259 BTRFS FILE SYSTEM
22602260 M: Chris Mason <clm@fb.com>
22612261 M: Josef Bacik <jbacik@fb.com>
2262+M: David Sterba <dsterba@suse.cz>
22622263 L: linux-btrfs@vger.kernel.org
22632264 W: http://btrfs.wiki.kernel.org/
22642265 Q: http://patchwork.kernel.org/project/linux-btrfs/list/
fs/btrfs/backref.c+10−3
@@ -1552,7 +1552,6 @@ int tree_backref_for_extent(unsigned long *ptr, struct extent_buffer *eb, · 1551 unmodified lines
15521552 {
15531553 int ret;
15541554 int type;
1555− struct btrfs_tree_block_info *info;
15561555 struct btrfs_extent_inline_ref *eiref;
15571556
15581557 if (*ptr == (unsigned long)-1)
@@ -1573,9 +1572,17 @@ int tree_backref_for_extent(unsigned long *ptr, struct extent_buffer *eb, · 14 unmodified lines
15731572 }
15741573
15751574 /* we can treat both ref types equally here */
1576− info = (struct btrfs_tree_block_info *)(ei + 1);
15771575 *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+ }
15791586
15801587 if (ret == 1)
15811588 *ptr = (unsigned long)-1;
fs/btrfs/delayed-inode.c+8−0
@@ -1857,6 +1857,14 @@ int btrfs_delayed_delete_inode_ref(struct inode *inode) · 1856 unmodified lines
18571857 {
18581858 struct btrfs_delayed_node *delayed_node;
18591859
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+
18601868 delayed_node = btrfs_get_or_create_delayed_node(inode);
18611869 if (IS_ERR(delayed_node))
18621870 return PTR_ERR(delayed_node);
fs/btrfs/extent-tree.c+6−6
@@ -3139,9 +3139,11 @@ static int write_one_cache_group(struct btrfs_trans_handle *trans, · 3138 unmodified lines
31393139 struct extent_buffer *leaf;
31403140
31413141 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;
31433145 goto fail;
3144− BUG_ON(ret); /* Corruption */
3146+ }
31453147
31463148 leaf = path->nodes[0];
31473149 bi = btrfs_item_ptr_offset(leaf, path->slots[0]);
@@ -3149,11 +3151,9 @@ static int write_one_cache_group(struct btrfs_trans_handle *trans, · 1 unmodified line
31493151 btrfs_mark_buffer_dirty(leaf);
31503152 btrfs_release_path(path);
31513153 fail:
3152− if (ret) {
3154+ if (ret)
31533155 btrfs_abort_transaction(trans, root, ret);
3154− return ret;
3155− }
3156− return 0;
3156+ return ret;
31573157
31583158 }
31593159
fs/btrfs/inode.c+3−1
@@ -6255,8 +6255,10 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) · 6254 unmodified lines
62556255
62566256 out_fail:
62576257 btrfs_end_transaction(trans, root);
6258− if (drop_on_err)
6258+ if (drop_on_err) {
6259+ inode_dec_link_count(inode);
62596260 iput(inode);
6261+ }
62606262 btrfs_balance_delayed_items(root);
62616263 btrfs_btree_balance_dirty(root);
62626264 return err;
fs/btrfs/scrub.c+1−1
@@ -2607,9 +2607,9 @@ static int scrub_extent_for_parity(struct scrub_parity *sparity, · 2606 unmodified lines
26072607 ret = scrub_pages_for_parity(sparity, logical, l, physical, dev,
26082608 flags, gen, mirror_num,
26092609 have_csum ? csum : NULL);
2610−skip:
26112610 if (ret)
26122611 return ret;
2612+skip:
26132613 len -= l;
26142614 logical += l;
26152615 physical += l;