"too many missing devices, writeable mount should not be allowed\n");
}
+ /* Hold the cleaner_mutex thread here so that we don't block
+ * on btrfs_recover_relocation later on. cleaner_kthread
+ * blocks on us instead. */
+ mutex_lock(&fs_info->cleaner_mutex);
fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root,
"btrfs-cleaner");
if (IS_ERR(fs_info->cleaner_kthread))
if (ret)
goto fail_qgroup;
- mutex_lock(&fs_info->cleaner_mutex);
+ /* We grabbed this mutex before we created the cleaner_kthread */
ret = btrfs_recover_relocation(tree_root);
- mutex_unlock(&fs_info->cleaner_mutex);
if (ret < 0) {
printk(KERN_WARNING
"BTRFS: failed to recover relocation\n");
goto fail_qgroup;
}
}
+ mutex_unlock(&fs_info->cleaner_mutex);
location.objectid = BTRFS_FS_TREE_OBJECTID;
location.type = BTRFS_ROOT_ITEM_KEY;
filemap_write_and_wait(fs_info->btree_inode->i_mapping);
fail_sysfs:
+ mutex_unlock(&fs_info->cleaner_mutex);
btrfs_sysfs_remove_one(fs_info);
fail_block_groups: