hdmi:rk3368/rk3288: modify phy termination resistance.
[firefly-linux-kernel-4.4.55.git] / drivers / md / raid5.c
index 2332b5ced0dd0e9069237779e5edee246352c9aa..1b6986ce5da9af6c4cc424c56b15c5ebe73f91ad 100644 (file)
@@ -2678,7 +2678,8 @@ static int fetch_block(struct stripe_head *sh, struct stripe_head_state *s,
             (s->failed >= 2 && fdev[1]->toread) ||
             (sh->raid_conf->level <= 5 && s->failed && fdev[0]->towrite &&
              !test_bit(R5_OVERWRITE, &fdev[0]->flags)) ||
-            (sh->raid_conf->level == 6 && s->failed && s->to_write))) {
+            ((sh->raid_conf->level == 6 || sh->sector >= sh->raid_conf->mddev->recovery_cp)
+             && s->failed && s->to_write))) {
                /* we would like to get this block, possibly by computing it,
                 * otherwise read it if the backing disk is insync
                 */
@@ -2852,7 +2853,8 @@ static void handle_stripe_dirtying(struct r5conf *conf,
         * generate correct data from the parity.
         */
        if (conf->max_degraded == 2 ||
-           (recovery_cp < MaxSector && sh->sector >= recovery_cp)) {
+           (recovery_cp < MaxSector && sh->sector >= recovery_cp &&
+            s->failed == 0)) {
                /* Calculate the real rcw later - for now make it
                 * look like rcw is cheaper
                 */