]> git.karo-electronics.de Git - karo-tx-linux.git/commit
md/raid5: avoid deadlock when raid5 array has unack badblocks during md_stop_writes.
authorNeilBrown <neilb@suse.de>
Tue, 22 Oct 2013 00:50:35 +0000 (11:50 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 24 Oct 2013 02:40:00 +0000 (13:40 +1100)
commit327f5f898010b46243d0dafb14dd0816f0b48361
tree6a3d6f16dd0d06846efa3c0ba3595fdd99d7ab3f
parentd1eaec44c9cd91f743ce58074b9eb18ca6f6e2d2
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.

Reported-by: Jianpeng Ma <majianpeng@gmail.com>
Reported-by: Bian Yu <bianyu@kedacom.com>
Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/md.c