]> git.baikalelectronics.ru Git - kernel.git/commit
md/raid10: fix leak of 'r10bio->remaining' for recovery
authorYu Kuai <yukuai3@huawei.com>
Fri, 10 Mar 2023 07:38:53 +0000 (15:38 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:35:43 +0000 (11:35 +0200)
commitdd98afd5478246b5682c20f31f5479e934c7093d
tree904b032ec21e833b33d8b2110d8f9a5e21155e02
parentbf747d0e637204ec35aa9dd8812c9ddbf0bd2b43
md/raid10: fix leak of 'r10bio->remaining' for recovery

[ Upstream commit 26208a7cffd0c7cbf14237ccd20c7270b3ffeb7e ]

raid10_sync_request() will add 'r10bio->remaining' for both rdev and
replacement rdev. However, if the read io fails, recovery_request_write()
returns without issuing the write io, in this case, end_sync_request()
is only called once and 'remaining' is leaked, cause an io hang.

Fix the problem by decreasing 'remaining' according to if 'bio' and
'repl_bio' is valid.

Fixes: 55da5f3739a4 ("md/raid10: handle recovery of replacement devices.")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20230310073855.1337560-5-yukuai1@huaweicloud.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/raid10.c