aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 3a7961ba161e..8cc47103a32e 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2490,17 +2490,23 @@ retry_root_backup:
2490 goto fail_trans_kthread; 2490 goto fail_trans_kthread;
2491 } 2491 }
2492 2492
2493 if (!(sb->s_flags & MS_RDONLY)) { 2493 if (sb->s_flags & MS_RDONLY)
2494 down_read(&fs_info->cleanup_work_sem); 2494 return 0;
2495 err = btrfs_orphan_cleanup(fs_info->fs_root); 2495
2496 if (!err) 2496 down_read(&fs_info->cleanup_work_sem);
2497 err = btrfs_orphan_cleanup(fs_info->tree_root); 2497 if ((ret = btrfs_orphan_cleanup(fs_info->fs_root)) ||
2498 (ret = btrfs_orphan_cleanup(fs_info->tree_root))) {
2498 up_read(&fs_info->cleanup_work_sem); 2499 up_read(&fs_info->cleanup_work_sem);
2500 close_ctree(tree_root);
2501 return ret;
2502 }
2503 up_read(&fs_info->cleanup_work_sem);
2499 2504
2500 if (err) { 2505 ret = btrfs_resume_balance_async(fs_info);
2501 close_ctree(tree_root); 2506 if (ret) {
2502 return err; 2507 printk(KERN_WARNING "btrfs: failed to resume balance\n");
2503 } 2508 close_ctree(tree_root);
2509 return ret;
2504 } 2510 }
2505 2511
2506 return 0; 2512 return 0;