]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
md: factor out sync completion update into helper
authorLi Nan <linan122@huawei.com>
Mon, 5 Jan 2026 11:02:56 +0000 (19:02 +0800)
committerYu Kuai <yukuai@fnnas.com>
Mon, 26 Jan 2026 05:16:21 +0000 (13:16 +0800)
commit6dd3aa08e83beeadf19f9d0f4110e5cd802a65d4
tree4ecb1e641e9918aa8091e2e60ee5e662b920067e
parentaf9c40ff5aed8149572ae920f520df88356b7950
md: factor out sync completion update into helper

Repeatedly reading 'mddev->recovery' flags in md_do_sync() may introduce
potential risk if this flag is modified during sync, leading to incorrect
offset updates. Therefore, replace direct 'mddev->recovery' checks with
'action'.

Move sync completion update logic into helper md_finish_sync(), which
improves readability and maintainability.

The reshape completion update remains safe as it only updated after
successful reshape when MD_RECOVERY_INTR is not set and 'curr_resync'
equals 'max_sectors'.

Link: https://lore.kernel.org/linux-raid/20260105110300.1442509-9-linan666@huaweicloud.com
Signed-off-by: Li Nan <linan122@huawei.com>
Reviewed-by: Yu Kuai <yukuai@fnnas.com>
Signed-off-by: Yu Kuai <yukuai@fnnas.com>
drivers/md/md.c