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)
committerJiri Slaby <jslaby@suse.cz>
Tue, 9 May 2017 06:19:50 +0000 (08:19 +0200)
commit204c56d845fcec43176160f831b86444d745cf67
tree2981b8b039916a1b59bc56898e57f266efac19c0
parent2021b2605e8a25a1683f9c62012c835b83c9af5f
md:raid1: fix a dead loop when read from a WriteMostly disk

commit 816b0acf3deb6d6be5d0519b286fdd4bafade905 upstream.

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>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/md/raid1.c