@@ -3827,9 +3827,13 @@ int btrfs_commit_super(struct btrfs_root *root)
{
struct btrfs_trans_handle *trans;
- mutex_lock(&root->fs_info->cleaner_mutex);
+ if (root->fs_info->open)
+ mutex_lock(&root->fs_info->cleaner_mutex);
+ else
+ ASSERT(mutex_is_locked(&root->fs_info->cleaner_mutex));
btrfs_run_delayed_iputs(root);
- mutex_unlock(&root->fs_info->cleaner_mutex);
+ if (root->fs_info->open)
+ mutex_unlock(&root->fs_info->cleaner_mutex);
wake_up_process(root->fs_info->cleaner_kthread);
/* wait until ongoing cleanup work done */