diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -1048,7 +1048,8 @@ static void ops_complete_reconstruct(void *stripe_head_ref) for (i = disks; i--; ) { struct r5dev *dev = &sh->dev[i]; - if (dev->written || i == pd_idx || i == qd_idx) + if ((dev->written && !test_bit(R5_Direct, &dev->flags)) || + i == pd_idx || i == qd_idx) set_bit(R5_UPTODATE, &dev->flags); } @@ -3450,7 +3451,8 @@ static void handle_stripe6(struct stripe_head *sh) (i == sh->pd_idx || i == qd_idx || dev->written)) { pr_debug("Writing block %d\n", i); - BUG_ON(!test_bit(R5_UPTODATE, &dev->flags)); + BUG_ON(!test_bit(R5_UPTODATE, &dev->flags) && + !test_bit(R5_Direct, &dev->flags)); set_bit(R5_Wantwrite, &dev->flags); if (!test_bit(R5_Insync, &dev->flags) || ((i == sh->pd_idx || i == qd_idx) && -- 1.7.1