]> www.infradead.org Git - users/hch/block.git/commit
md: don't fail action_store() if sync_thread is not registered
authorYu Kuai <yukuai3@huawei.com>
Tue, 11 Jun 2024 13:22:46 +0000 (21:22 +0800)
committerSong Liu <song@kernel.org>
Wed, 12 Jun 2024 16:27:50 +0000 (16:27 +0000)
commit5ce10a38590c77f20d0dc706944f79e7d56a7400
tree8a3f3e25e142b5fce5734b99aa5bb6f3e8fcd90c
parentdf79234bdc3f441bec99dfc8199b6f2c673203ed
md: don't fail action_store() if sync_thread is not registered

MD_RECOVERY_RUNNING will always be set when trying to register a new
sync_thread, however, if md_start_sync() turns out to do nothing,
MD_RECOVERY_RUNNING will be cleared in this case. And during the race
window, action_store() will return -EBUSY, which will cause some
mdadm tests to fail. For example:

The test 07reshape5intr will add a new disk to array, then start
reshape:

mdadm /dev/md0 --add /dev/xxx
mdadm --grow /dev/md0 -n 3

And add_bound_rdev() from mdadm --add will set MD_RECOVERY_NEEDED,
then during the race windown, mdadm --grow will fail.

Fix the problem by waiting in action_store() during the race window,
fail only if sync_thread is registered.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20240611132251.1967786-8-yukuai1@huaweicloud.com
drivers/md/md.c
drivers/md/md.h