]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
md: don't leave 'MD_RECOVERY_FROZEN' in error path of md_set_readonly()
authorYu Kuai <yukuai3@huawei.com>
Tue, 5 Dec 2023 09:42:14 +0000 (17:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Dec 2023 17:36:42 +0000 (18:36 +0100)
commitf5311389262d572969047672e4b27f49256185dd
tree55f55509ea2ed21787244a2794d9132cbc797c17
parent4a52acc91015ba701b907773b184186adcdd0b80
md: don't leave 'MD_RECOVERY_FROZEN' in error path of md_set_readonly()

[ Upstream commit c9f7cb5b2bc968adcdc686c197ed108f47fd8eb0 ]

If md_set_readonly() failed, the array could still be read-write, however
'MD_RECOVERY_FROZEN' could still be set, which leave the array in an
abnormal state that sync or recovery can't continue anymore.
Hence make sure the flag is cleared after md_set_readonly() returns.

Fixes: 88724bfa68be ("md: wait for pending superblock updates before switching to read-only")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Acked-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20231205094215.1824240-3-yukuai1@huaweicloud.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/md.c