]> git.ipfire.org Git - thirdparty/linux.git/commit
badblocks: fix missing bad blocks on retry in _badblocks_check()
authorZheng Qixing <zhengqixing@huawei.com>
Thu, 27 Feb 2025 07:55:04 +0000 (15:55 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 6 Mar 2025 15:03:28 +0000 (08:03 -0700)
commit5236f041fa6c81c71eabad44897e54a0d6d5bbf6
treedf2841dc2c23567429d9e55a70a9f5f8cc270a78
parent9ec65dec634a752ab0a1203510ee190356e4cf1a
badblocks: fix missing bad blocks on retry in _badblocks_check()

The bad blocks check would miss bad blocks when retrying under contention,
as checking parameters are not reset. These stale values from the previous
attempt could lead to incorrect scanning in the subsequent retry.

Move seqlock to outer function and reinitialize checking state for each
retry. This ensures a clean state for each check attempt, preventing any
missed bad blocks.

Fixes: 3ea3354cb9f0 ("badblocks: improve badblocks_check() for multiple ranges handling")
Signed-off-by: Zheng Qixing <zhengqixing@huawei.com>
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Acked-by: Coly Li <colyli@kernel.org>
Link: https://lore.kernel.org/r/20250227075507.151331-10-zhengqixing@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/badblocks.c