]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
md: restore 'noio_flag' for the last mddev_resume()
authorYu Kuai <yukuai3@huawei.com>
Wed, 28 Jun 2023 01:29:31 +0000 (09:29 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:48:14 +0000 (09:48 +0200)
commita5dc1f8342fa5a28e343102a7746da7679abc3d5
tree5d1de684dd54d440375214c45ddb612022a8cf91
parent8267f8119091c683d6d38450687805b9c1cbef1d
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>
drivers/md/md.c