Commit 6545eefc authored by Neil Brown's avatar Neil Brown Committed by David S. Miller

[PATCH] md - 2 of 3 - Fix bug in raid5 AGAIN

That recent bug fix in raid5 just changed the bug, it didn't fix it.
I think that the original code was actually wrong, which didn't
help.

This time, the code actually matches the nearby comment, that has been expanded
a bit, so I feel somewhat more confident that it is actually right.
parent 181bdc17
...@@ -933,13 +933,16 @@ static void handle_stripe(struct stripe_head *sh) ...@@ -933,13 +933,16 @@ static void handle_stripe(struct stripe_head *sh)
test_bit(R5_UPTODATE, &dev->flags)) test_bit(R5_UPTODATE, &dev->flags))
|| (failed == 1 && failed_num == sh->pd_idx)) || (failed == 1 && failed_num == sh->pd_idx))
) { ) {
/* any written block on an uptodate or failed drive can be returned */ /* any written block on an uptodate or failed drive can be returned.
* Note that if we 'wrote' to a failed drive, it will be UPTODATE, but
* never LOCKED, so we don't need to test 'failed' directly.
*/
for (i=disks; i--; ) for (i=disks; i--; )
if (sh->dev[i].written) { if (sh->dev[i].written) {
dev = &sh->dev[i]; dev = &sh->dev[i];
if (!test_bit(R5_Insync, &sh->dev[sh->pd_idx].flags) && if (!test_bit(R5_LOCKED, &dev->flags) &&
(!test_bit(R5_LOCKED, &dev->flags) && test_bit(R5_UPTODATE, &dev->flags)) ) { test_bit(R5_UPTODATE, &dev->flags) ) {
/* maybe we can return some write requests */ /* We can return any write requests */
struct bio *wbi, *wbi2; struct bio *wbi, *wbi2;
PRINTK("Return write for disc %d\n", i); PRINTK("Return write for disc %d\n", i);
wbi = dev->written; wbi = dev->written;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment