md:raid1: fix a dead loop when read from a WriteMostly disk
authorWei Fang <fangwei1@huawei.com>
Mon, 21 Mar 2016 11:18:32 +0000 (19:18 +0800)
committerShaohua Li <shli@fb.com>
Thu, 31 Mar 2016 17:04:17 +0000 (10:04 -0700)
commit816b0acf3deb6d6be5d0519b286fdd4bafade905
tree0b24951e8a0534dfc786a0fdd6faf1fd1459646e
parentc05c2ec96bb8b7310da1055c7b9d786a3ec6dc0c
md:raid1: fix a dead loop when read from a WriteMostly disk

If first_bad == this_sector when we get the WriteMostly disk
in read_balance(), valid disk will be returned with zero
max_sectors. It'll lead to a dead loop in make_request(), and
OOM will happen because of endless allocation of struct bio.

Since we can't get data from this disk in this case, so
continue for another disk.

Signed-off-by: Wei Fang <fangwei1@huawei.com>
Signed-off-by: Shaohua Li <shli@fb.com>
drivers/md/raid1.c