|
@@ -3619,9 +3619,20 @@ static int fetch_block(struct stripe_head *sh, struct stripe_head_state *s,
|
|
|
BUG_ON(test_bit(R5_Wantcompute, &dev->flags));
|
|
|
BUG_ON(test_bit(R5_Wantread, &dev->flags));
|
|
|
BUG_ON(sh->batch_head);
|
|
|
+
|
|
|
+ /*
|
|
|
+ * In the raid6 case if the only non-uptodate disk is P
|
|
|
+ * then we already trusted P to compute the other failed
|
|
|
+ * drives. It is safe to compute rather than re-read P.
|
|
|
+ * In other cases we only compute blocks from failed
|
|
|
+ * devices, otherwise check/repair might fail to detect
|
|
|
+ * a real inconsistency.
|
|
|
+ */
|
|
|
+
|
|
|
if ((s->uptodate == disks - 1) &&
|
|
|
+ ((sh->qd_idx >= 0 && sh->pd_idx == disk_idx) ||
|
|
|
(s->failed && (disk_idx == s->failed_num[0] ||
|
|
|
- disk_idx == s->failed_num[1]))) {
|
|
|
+ disk_idx == s->failed_num[1])))) {
|
|
|
/* have disk failed, and we're requested to fetch it;
|
|
|
* do compute it
|
|
|
*/
|