Skip to content

Commit ea32af4

Browse files
fdmananakdave
authored andcommitted
btrfs: zoned: fix wrong mutex unlock on failure to allocate log root tree
When syncing the log, if we fail to allocate the root node for the log root tree: 1) We are unlocking fs_info->tree_log_mutex, but at this point we have not yet locked this mutex; 2) We have locked fs_info->tree_root->log_mutex, but we end up not unlocking it; So fix this by unlocking fs_info->tree_root->log_mutex instead of fs_info->tree_log_mutex. Fixes: e75f9fd ("btrfs: zoned: move log tree node allocation out of log_root_tree->log_mutex") CC: [email protected] # 5.13+ Reviewed-by: Nikolay Borisov <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 9cc0b83 commit ea32af4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/tree-log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3173,7 +3173,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
31733173
if (!log_root_tree->node) {
31743174
ret = btrfs_alloc_log_tree_node(trans, log_root_tree);
31753175
if (ret) {
3176-
mutex_unlock(&fs_info->tree_log_mutex);
3176+
mutex_unlock(&fs_info->tree_root->log_mutex);
31773177
goto out;
31783178
}
31793179
}

0 commit comments

Comments
 (0)