Commit 0ed9d7ff authored by Li Nan's avatar Li Nan
Browse files

md: do not delete safemode_timer in mddev_suspend

maillist inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9JMCR

Reference: https://lore.kernel.org/all/20240508092053.1447930-1-linan666@huaweicloud.com/



--------------------------------

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 0d9f4f13 ("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 0dd84b31 ("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.

Fixes: 0dd84b31 ("md: call __md_stop_writes in md_stop")
Signed-off-by: default avatarLi Nan <linan122@huawei.com>
parent a00ba8b5
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -490,7 +490,6 @@ int mddev_suspend(struct mddev *mddev, bool interruptible)
	 */
	WRITE_ONCE(mddev->suspended, mddev->suspended + 1);

	del_timer_sync(&mddev->safemode_timer);
	/* restrict memory reclaim I/O during raid array is suspend */
	mddev->noio_flag = memalloc_noio_save();