diff options
author | Yu Kuai | 2023-06-28 09:29:31 +0800 |
---|---|---|
committer | Greg Kroah-Hartman | 2023-09-13 09:42:41 +0200 |
commit | 097f30f0cef875b668c6f6896920c6c360e0082b (patch) | |
tree | 6a685fa3675cae6b1d9cb1032ba82c39518bac72 /drivers/md/md.c | |
parent | 835cbfebc1c54c0e8a1ffedaf48381178d390135 (diff) |
md: restore 'noio_flag' for the last mddev_resume()
[ Upstream commit e24ed04389f9619e0aaef615a8948633c182a8b0 ]
memalloc_noio_save() is called for the first mddev_suspend(), and
repeated mddev_suspend() only increase 'suspended'. However,
memalloc_noio_restore() is also called for the first mddev_resume(),
which means that memory reclaim will be enabled before the last
mddev_resume() is called, while the array is still suspended.
Fix this problem by restore 'noio_flag' for the last mddev_resume().
Fixes: 78f57ef9d50a ("md: use memalloc scope APIs in mddev_suspend()/mddev_resume()")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20230628012931.88911-3-yukuai1@huaweicloud.com
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 1c44294c625a..443837fe6291 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -485,11 +485,13 @@ EXPORT_SYMBOL_GPL(mddev_suspend); void mddev_resume(struct mddev *mddev) { - /* entred the memalloc scope from mddev_suspend() */ - memalloc_noio_restore(mddev->noio_flag); lockdep_assert_held(&mddev->reconfig_mutex); if (--mddev->suspended) return; + + /* entred the memalloc scope from mddev_suspend() */ + memalloc_noio_restore(mddev->noio_flag); + percpu_ref_resurrect(&mddev->active_io); wake_up(&mddev->sb_wait); mddev->pers->quiesce(mddev, 0); |