diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2012-06-22 14:24:12 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2012-07-02 15:39:16 -0400 |
commit | 68310a5e42f93c2242ec1836c3b18d531e0065e2 (patch) | |
tree | cf457369274a1633ba02170fcb6aab0114906f0a /fs/btrfs/disk-io.c | |
parent | c3473e830074ef04f974f2829690942dd8580619 (diff) |
Btrfs: restore restriper state on all mounts
Fix a bug that triggered asserts in btrfs_balance() in both normal and
resume modes -- restriper state was not properly restored on read-only
mounts. This factors out resuming code from btrfs_restore_balance(),
which is now also called earlier in the mount sequence to avoid the
problem of some early writes getting the old profile.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 7d7bc8eace86..3a7961ba161e 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -2354,12 +2354,17 @@ retry_root_backup: | |||
2354 | BTRFS_CSUM_TREE_OBJECTID, csum_root); | 2354 | BTRFS_CSUM_TREE_OBJECTID, csum_root); |
2355 | if (ret) | 2355 | if (ret) |
2356 | goto recovery_tree_root; | 2356 | goto recovery_tree_root; |
2357 | |||
2358 | csum_root->track_dirty = 1; | 2357 | csum_root->track_dirty = 1; |
2359 | 2358 | ||
2360 | fs_info->generation = generation; | 2359 | fs_info->generation = generation; |
2361 | fs_info->last_trans_committed = generation; | 2360 | fs_info->last_trans_committed = generation; |
2362 | 2361 | ||
2362 | ret = btrfs_recover_balance(fs_info); | ||
2363 | if (ret) { | ||
2364 | printk(KERN_WARNING "btrfs: failed to recover balance\n"); | ||
2365 | goto fail_block_groups; | ||
2366 | } | ||
2367 | |||
2363 | ret = btrfs_init_dev_stats(fs_info); | 2368 | ret = btrfs_init_dev_stats(fs_info); |
2364 | if (ret) { | 2369 | if (ret) { |
2365 | printk(KERN_ERR "btrfs: failed to init dev_stats: %d\n", | 2370 | printk(KERN_ERR "btrfs: failed to init dev_stats: %d\n", |
@@ -2492,9 +2497,6 @@ retry_root_backup: | |||
2492 | err = btrfs_orphan_cleanup(fs_info->tree_root); | 2497 | err = btrfs_orphan_cleanup(fs_info->tree_root); |
2493 | up_read(&fs_info->cleanup_work_sem); | 2498 | up_read(&fs_info->cleanup_work_sem); |
2494 | 2499 | ||
2495 | if (!err) | ||
2496 | err = btrfs_recover_balance(fs_info->tree_root); | ||
2497 | |||
2498 | if (err) { | 2500 | if (err) { |
2499 | close_ctree(tree_root); | 2501 | close_ctree(tree_root); |
2500 | return err; | 2502 | return err; |