]> www.infradead.org Git - users/hch/block.git/commit
md: do not delete safemode_timer in mddev_suspend
authorLi Nan <linan122@huawei.com>
Wed, 8 May 2024 09:20:53 +0000 (17:20 +0800)
committerSong Liu <song@kernel.org>
Mon, 10 Jun 2024 16:26:28 +0000 (16:26 +0000)
commita8768a134518e406d41799a3594aeb74e0889cf7
treecc0f47dc6d1134b10169944e1bd6bdf42f455d5f
parent83a7eefedc9b56fe7bfeff13b6c7356688ffa670
md: do not delete safemode_timer in mddev_suspend

The deletion of safemode_timer in mddev_suspend() is redundant and
potentially harmful now. If timer is about to be woken up but gets
deleted, 'in_sync' will remain 0 until the next write, causing array
to stay in the 'active' state instead of transitioning to 'clean'.

Commit 0d9f4f135eb6 ("MD: Add del_timer_sync to mddev_suspend (fix
nasty panic))" introduced this deletion for dm, because if timer fired
after dm is destroyed, the resource which the timer depends on might
have been freed.

However, commit 0dd84b319352 ("md: call __md_stop_writes in md_stop")
added __md_stop_writes() to md_stop(), which is called before freeing
resource. Timer is deleted in __md_stop_writes(), and the origin issue
is resolved. Therefore, delete safemode_timer can be removed safely now.

Signed-off-by: Li Nan <linan122@huawei.com>
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20240508092053.1447930-1-linan666@huaweicloud.com
drivers/md/md.c