diff mbox series

[for-next,2/3] btrfs: properly unlock log_mutex in error case

Message ID 20210201085204.700090-3-naohiro.aota@wdc.com (mailing list archive)
State New, archived
Headers show
Series Fix potential deadlock, types and typo in zoned series | expand

Commit Message

Naohiro Aota Feb. 1, 2021, 8:52 a.m. UTC
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 <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
 fs/btrfs/tree-log.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

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;
 		}
 	}