Commit 4934b64
md: fix 'delete_mutex' deadlock
Commit 3ce94ce ("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: 3ce94ce ("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.com1 parent a1d7671 commit 4934b64
2 files changed
Lines changed: 10 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
643 | 643 | | |
644 | 644 | | |
645 | 645 | | |
646 | | - | |
647 | 646 | | |
648 | 647 | | |
649 | 648 | | |
| |||
749 | 748 | | |
750 | 749 | | |
751 | 750 | | |
752 | | - | |
| 751 | + | |
753 | 752 | | |
754 | 753 | | |
755 | 754 | | |
| 755 | + | |
756 | 756 | | |
757 | | - | |
758 | | - | |
759 | | - | |
| 757 | + | |
| 758 | + | |
760 | 759 | | |
761 | | - | |
762 | | - | |
763 | | - | |
764 | | - | |
765 | | - | |
766 | | - | |
767 | | - | |
768 | | - | |
769 | | - | |
770 | | - | |
771 | | - | |
772 | 760 | | |
773 | 761 | | |
774 | 762 | | |
| |||
808 | 796 | | |
809 | 797 | | |
810 | 798 | | |
811 | | - | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
812 | 804 | | |
813 | 805 | | |
814 | 806 | | |
| |||
2488 | 2480 | | |
2489 | 2481 | | |
2490 | 2482 | | |
2491 | | - | |
2492 | 2483 | | |
2493 | | - | |
2494 | 2484 | | |
2495 | 2485 | | |
2496 | 2486 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
531 | 531 | | |
532 | 532 | | |
533 | 533 | | |
534 | | - | |
| 534 | + | |
535 | 535 | | |
536 | 536 | | |
537 | | - | |
538 | | - | |
539 | 537 | | |
540 | 538 | | |
541 | 539 | | |
| |||
0 commit comments