Fix deadlock due to lock sequence in bdev_unregister_unsafe

This commit is contained in:
Zht-Try 2024-01-05 16:44:58 +08:00 committed by Zht-Try
parent fc5debf721
commit a6810b671c
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,27 @@
From 0489d5319ea6a0918c1bc7bd9c3d1da61543467b Mon Sep 17 00:00:00 2001
From: zhanghongtao <zhanghongtao22@huawei.com>
Date: Mon, 18 Dec 2023 19:52:56 +0800
Subject: [PATCH] Fix deadlock due to lock sequence in bdev_unregister_unsafe
Signed-off-by: Hongtao Zhang <zhanghongtao22@huawei.com>
---
lib/bdev/bdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c
index 4c63e8b..64027c6 100644
--- a/lib/bdev/bdev.c
+++ b/lib/bdev/bdev.c
@@ -5758,8 +5758,8 @@ bdev_unregister_unsafe(struct spdk_bdev *bdev)
pthread_mutex_unlock(&bdev->internal.mutex);
pthread_mutex_unlock(&g_bdev_mgr.mutex);
_remove_notify(desc);
- pthread_mutex_lock(&bdev->internal.mutex);
pthread_mutex_lock(&g_bdev_mgr.mutex);
+ pthread_mutex_lock(&bdev->internal.mutex);
}
/* If there are no descriptors, proceed removing the bdev */
--
2.27.0

View File

@ -4,7 +4,7 @@
Name: spdk
Version: 21.01.1
Release: 18
Release: 19
Summary: Set of libraries and utilities for high performance user-mode storage
License: BSD and MIT
URL: http://spdk.io
@ -53,6 +53,7 @@ Patch41: 0041-barrier-LOONGARCH-memory-barriers.patch
Patch42: 0042-nvme-pcie-add-memory-barrier-for-LOONGARCH.patch
Patch43: 0043-build-Specify-the-target-build-architecture-for-LOON.patch
Patch44: 0044-lib-bdev-return-error-when-failing-to-get-resource.patch
Patch45: 0045-Fix-deadlock-due-to-lock-sequence-in-bdev_unregister.patch
%define package_version %{version}-%{release}
@ -229,6 +230,9 @@ mv doc/output/html/ %{install_docdir}
%changelog
* Thu Jan 4 2024 Hongtao Zhang <zhanghongtao22@huawei.com> - 21.01.1-19
- Fix deadlock due to lock sequence in bdev_unregister_unsafe
* Thu Dec 14 2023 Hongtao Zhang <zhanghongtao22@huawei.com> - 21.01.1-18
- Return error when failing to get resource