Commit a705b11
md/raid5-cache: fix a deadlock in r5l_exit_log()
Commit b13015a ("md/raid5-cache: Clear conf->log after finishing
work") introduce a new problem:
// caller hold reconfig_mutex
r5l_exit_log
flush_work(&log->disable_writeback_work)
r5c_disable_writeback_async
wait_event
/*
* conf->log is not NULL, and mddev_trylock()
* will fail, wait_event() can never pass.
*/
conf->log = NULL
Fix this problem by setting 'config->log' to NULL before wake_up() as it
used to be, so that wait_event() from r5c_disable_writeback_async() can
exist. In the meantime, move forward md_unregister_thread() so that
null-ptr-deref this commit fixed can still be fixed.
Fixes: b13015a ("md/raid5-cache: Clear conf->log after finishing work")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20230708091727.1417894-1-yukuai1@huaweicloud.com
Signed-off-by: Song Liu <song@kernel.org>1 parent 66a6a5d commit a705b11
1 file changed
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3168 | 3168 | | |
3169 | 3169 | | |
3170 | 3170 | | |
3171 | | - | |
3172 | | - | |
3173 | | - | |
3174 | 3171 | | |
3175 | 3172 | | |
| 3173 | + | |
| 3174 | + | |
| 3175 | + | |
| 3176 | + | |
3176 | 3177 | | |
| 3178 | + | |
| 3179 | + | |
3177 | 3180 | | |
3178 | 3181 | | |
3179 | 3182 | | |
| |||
0 commit comments