diff options
Diffstat (limited to 'fs/btrfs/disk-io.c')
| -rw-r--r-- | fs/btrfs/disk-io.c | 13 | 
1 files changed, 12 insertions, 1 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 009e3bd18f23..2b59201b955c 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1982,7 +1982,12 @@ struct btrfs_root *open_ctree(struct super_block *sb,  	if (!(sb->s_flags & MS_RDONLY)) {  		ret = btrfs_recover_relocation(tree_root); -		BUG_ON(ret); +		if (ret < 0) { +			printk(KERN_WARNING +			       "btrfs: failed to recover relocation\n"); +			err = -EINVAL; +			goto fail_trans_kthread; +		}  	}  	location.objectid = BTRFS_FS_TREE_OBJECTID; @@ -1993,6 +1998,12 @@ struct btrfs_root *open_ctree(struct super_block *sb,  	if (!fs_info->fs_root)  		goto fail_trans_kthread; +	if (!(sb->s_flags & MS_RDONLY)) { +		down_read(&fs_info->cleanup_work_sem); +		btrfs_orphan_cleanup(fs_info->fs_root); +		up_read(&fs_info->cleanup_work_sem); +	} +  	return tree_root;  fail_trans_kthread:  | 
