Skip to content
Commit 30b8feb7 authored by NeilBrown's avatar NeilBrown
Browse files

md/raid5: avoid deadlock when raid5 array has unack badblocks during md_stop_writes.



When raid5 recovery hits a fresh badblock, this badblock will flagged as unack
badblock until md_update_sb() is called.
But md_stop will take reconfig lock which means raid5d can't call
md_update_sb() in md_check_recovery(), the badblock will always
be unack, so raid5d thread enters an infinite loop and md_stop_write()
can never stop sync_thread. This causes deadlock.

To solve this, when STOP_ARRAY ioctl is issued and sync_thread is
running, we need set md->recovery FROZEN and INTR flags and wait for
sync_thread to stop before we (re)take reconfig lock.

This requires that raid5 reshape_request notices MD_RECOVERY_INTR
(which it probably should have noticed anyway) and stops waiting for a
metadata update in that case.

Reported-by: default avatarJianpeng Ma <majianpeng@gmail.com>
Reported-by: default avatarBian Yu <bianyu@kedacom.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent c91abf5a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment