diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 7aa958ed28476a90871427affa781928adbb81f9..d2361b162de59b316fe8fba4d1a2d3808dc416a6 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -2502,7 +2502,10 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp /* There is nowhere to write, so all non-sync * drives must be failed - so we are finished */ - sector_t rv = max_sector - sector_nr; + sector_t rv; + if (min_bad > 0) + max_sector = sector_nr + min_bad; + rv = max_sector - sector_nr; *skipped = 1; put_buf(r1_bio); return rv;