We need to unlock log_root_tree->log_mutex in case of an error.

Fixes: 122cfba0d2eb ("btrfs: reorder log node allocation")
Reported-by: kernel test robot <l...@intel.com>
Reported-by: Julia Lawall <julia.law...@lip6.fr>
Signed-off-by: Naohiro Aota <naohiro.a...@wdc.com>
---
 fs/btrfs/tree-log.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 1dd7e34fe484..ed101420934c 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3164,6 +3164,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
                ret = btrfs_alloc_log_tree_node(trans, log_root_tree);
                if (ret) {
                        mutex_unlock(&fs_info->tree_log_mutex);
+                       mutex_unlock(&log_root_tree->log_mutex);
                        goto out;
                }
        }
-- 
2.30.0

Reply via email to