md/raid1: end bio when the device faulty
authorYufen Yu <yuyufen@huawei.com>
Fri, 19 Jul 2019 05:48:46 +0000 (13:48 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Oct 2019 11:09:38 +0000 (13:09 +0200)
commit1cd972e0a10760a1fa27d9830d78446c891c23b6
treedc838428140bd1d78cb9cf0bc369809f638bd4d3
parent7d75275fbfb12d7c04cfb34f77cbe9d9d150ad5f
md/raid1: end bio when the device faulty

[ Upstream commit eeba6809d8d58908b5ed1b5ceb5fcb09a98a7cad ]

When write bio return error, it would be added to conf->retry_list
and wait for raid1d thread to retry write and acknowledge badblocks.

In narrow_write_error(), the error bio will be split in the unit of
badblock shift (such as one sector) and raid1d thread issues them
one by one. Until all of the splited bio has finished, raid1d thread
can go on processing other things, which is time consuming.

But, there is a scene for error handling that is not necessary.
When the device has been set faulty, flush_bio_list() may end
bios in pending_bio_list with error status. Since these bios
has not been issued to the device actually, error handlding to
retry write and acknowledge badblocks make no sense.

Even without that scene, when the device is faulty, badblocks info
can not be written out to the device. Thus, we also no need to
handle the error IO.

Signed-off-by: Yufen Yu <yuyufen@huawei.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/raid1.c