diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-04 20:31:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-04 20:31:32 -0500 |
commit | 2cdcb2b5b5d6d7c1bdefbc1a63187d47fd809408 (patch) | |
tree | 21d2465f170867584a2a0e5a8a9bd5227424ec82 /fs | |
parent | 78baab7aa843ef01644195d341bee118cbe4bf19 (diff) | |
parent | 909c3a22da3b8d2cfd3505ca5658f0176859d400 (diff) |
Merge branch 'for-linus-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull btrfs fix from Chris Mason:
"Filipe nailed down a problem where tree log replay would do some work
that orphan code wasn't expecting to be done yet, leading to BUG_ON"
* 'for-linus-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
Btrfs: fix loading of orphan roots leading to BUG_ON
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/root-tree.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c index 7cf8509deda7..2c849b08a91b 100644 --- a/fs/btrfs/root-tree.c +++ b/fs/btrfs/root-tree.c | |||
@@ -310,8 +310,16 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root) | |||
310 | set_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED, &root->state); | 310 | set_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED, &root->state); |
311 | 311 | ||
312 | err = btrfs_insert_fs_root(root->fs_info, root); | 312 | err = btrfs_insert_fs_root(root->fs_info, root); |
313 | /* | ||
314 | * The root might have been inserted already, as before we look | ||
315 | * for orphan roots, log replay might have happened, which | ||
316 | * triggers a transaction commit and qgroup accounting, which | ||
317 | * in turn reads and inserts fs roots while doing backref | ||
318 | * walking. | ||
319 | */ | ||
320 | if (err == -EEXIST) | ||
321 | err = 0; | ||
313 | if (err) { | 322 | if (err) { |
314 | BUG_ON(err == -EEXIST); | ||
315 | btrfs_free_fs_root(root); | 323 | btrfs_free_fs_root(root); |
316 | break; | 324 | break; |
317 | } | 325 | } |