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)
committerWilly Tarreau <w@1wt.eu>
Tue, 20 Jun 2017 06:02:58 +0000 (08:02 +0200)
commit7a56cc091820dc84e1260a74ec316d4a4b12d372
tree54f9d5e2d5f7f024616b39c61a4758938f895256
parent523d7696aa00e1a7417a425b0c8f53b22c4d65cd
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>
Signed-off-by: Willy Tarreau <w@1wt.eu>
drivers/md/raid1.c