On Wed, Jun 28, 2023 at 2:29 PM Yu Kuai [off-list ref] wrote:
Hi,
在 2023/06/28 9:29, Yu Kuai 写道:
quoted
From: Yu Kuai <redacted>
Some levels doesn't implement "pers->quiesce", for example
raid0_quiesce() is empty, and now that all levels will drop 'active_io'
until io is done, wait for 'active_io' to be 0 is enough to make sure all
normal io is done, and percpu_ref_kill() for 'active_io' will make sure
no new normal io can be dispatched. There is no need to call
"pers->quiesce" anymore from mddev_suspend().
Just found that this patch actually prevent null_ptr_deref in some cases
that "pers->quiesce" is NULl for some personalities, and caller of
mddev_suspend() doesn't check this. For example, suspend_lo_store()
checks "pers->quiesce" is not NULL before calling mddev_suspend(), while
suspend_hi_store() doesn't.
Let's refactor the code so that suspend_lo_store() and suspend_hi_store()
share code for this logic.
Thanks,
Song