summaryrefslogtreecommitdiffstats
path: root/drivers/md/md.h
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2023-06-21 22:29:33 +0800
committerSong Liu <song@kernel.org>2023-06-23 09:41:47 -0700
commit4934b6401a812f9fe368e7d2d091cd1d120ea262 (patch)
tree6396b4d2209a4229b8357a11c78aaafcb3512072 /drivers/md/md.h
parenta1d7671910965ca9f8f0377e7e3bfd1179fba4d8 (diff)
downloadlinux-4934b6401a812f9fe368e7d2d091cd1d120ea262.tar.gz
linux-4934b6401a812f9fe368e7d2d091cd1d120ea262.tar.bz2
linux-4934b6401a812f9fe368e7d2d091cd1d120ea262.zip
md: fix 'delete_mutex' deadlock
Commit 3ce94ce5d05a ("md: fix duplicate filename for rdev") introduce a new lock 'delete_mutex', and trigger a new deadlock: t1: remove rdev t2: sysfs writer rdev_attr_store rdev_attr_store mddev_lock state_store md_kick_rdev_from_array lock delete_mutex list_add mddev->deleting unlock delete_mutex mddev_unlock mddev_lock ... lock delete_mutex kobject_del // wait for sysfs writers to be done mddev_unlock lock delete_mutex // wait for delete_mutex, deadlock 'delete_mutex' is used to protect the list 'mddev->deleting', turns out that this list can be protected by 'reconfig_mutex' directly, and this lock can be removed. Fix this problem by removing the lock, and use 'reconfig_mutex' to protect the list. mddev_unlock() will move this list to a local list to be handled after 'reconfig_mutex' is dropped. Fixes: 3ce94ce5d05a ("md: fix duplicate filename for rdev") Signed-off-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20230621142933.1395629-1-yukuai1@huaweicloud.com
Diffstat (limited to 'drivers/md/md.h')
-rw-r--r--drivers/md/md.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/md/md.h b/drivers/md/md.h
index bfd2306bc750..1aef86bf3fc3 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -531,11 +531,9 @@ struct mddev {
/*
* Temporarily store rdev that will be finally removed when
- * reconfig_mutex is unlocked.
+ * reconfig_mutex is unlocked, protected by reconfig_mutex.
*/
struct list_head deleting;
- /* Protect the deleting list */
- struct mutex delete_mutex;
bool has_superblocks:1;
bool fail_last_dev:1;