On Fri, Feb 21, 2020 at 05:31:22PM +0100, David Sterba wrote:
> btrfs_prepare_extent_commit(fs_info);
> @@ -2346,8 +2326,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
> if (ret) {
> btrfs_handle_fs_error(fs_info, ret,
> "Error while writing out transaction");
> - mutex_unlock(&fs_info->tree_log_mutex);
> - goto scrub_continue;
> + goto unlock_tree_log;
Hm and this one is also wrong, in other cases that jump to
unlock_tree_log the unlocking order is tree_log_mutex/reloc_mutex, while
a few lines before there is unlock of reloc_mutex (while tree_log_mutex
is still held). This means the unlocking order is reversed compared to
the other cases and we can't jump to the label as this would lead to
double unlock of reloc_mutex.
So the above hunk must stay as is, with a comment.
> }
>
> ret = write_all_supers(fs_info, 0);
> @@ -2394,6 +2373,10 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
>
> return ret;
>
> +unlock_tree_log:
> + mutex_unlock(&fs_info->tree_log_mutex);
> +unlock_reloc:
> + mutex_unlock(&fs_info->reloc_mutex);
> scrub_continue:
> btrfs_scrub_continue(fs_info);
> cleanup_transaction:
> --
> 2.25.0