diff options
author | Wei Fang <fangwei1@huawei.com> | 2016-03-21 12:18:32 +0100 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2016-03-31 19:04:17 +0200 |
commit | 816b0acf3deb6d6be5d0519b286fdd4bafade905 (patch) | |
tree | 0b24951e8a0534dfc786a0fdd6faf1fd1459646e /drivers/md/raid1.c | |
parent | Merge branch 'parisc-4.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/... (diff) | |
download | linux-816b0acf3deb6d6be5d0519b286fdd4bafade905.tar.xz linux-816b0acf3deb6d6be5d0519b286fdd4bafade905.zip |
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>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 39fb21e048e6..a7f2b9c9f8a0 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -570,7 +570,7 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect if (best_dist_disk < 0) { if (is_badblock(rdev, this_sector, sectors, &first_bad, &bad_sectors)) { - if (first_bad < this_sector) + if (first_bad <= this_sector) /* Cannot use this */ continue; best_good_sectors = first_bad - this_sector; |