Skip to contentSkip to conversation

raid5 oopses on 2nd failed device

PATCH-2.4 Alex Tomas 1 participant 1 message Apr 15, 2003 MD RAID

lore
Share & tools
lore

Alex Tomas

author
#0 lore raw

hi!

it looks like raid5 is buggy. as 2nd device is failed, I got oops. it's BUG at raid5.c:212. this is because sh->written[N] isn't NULL. raid5d thread try to handle this stripe, but following condition skip handling:

        /* might be able to return some write requests if the parity block
         * is safe, or on a failed drive
         */
        bh = sh->bh_cache[sh->pd_idx];
        if ( written &&
             ( (conf->disks[sh->pd_idx].operational && !buffer_locked(bh) && buffer_uptodate(bh))
               || (failed == 1 && failed_num == sh->pd_idx))
            ) {

I suggest to fail requests which can't be returned as successful.

with best regards

drivers/md/raid5.c +13 -1
diff -puNr linux/drivers/md/raid5.c edited/drivers/md/raid5.c
@@ -938,7 +938,19 @@ static void handle_stripe(struct stripe_
 		    }
 		}
 	}
-		
+	
+	/* if already written requests can't be returned as successful fail them */
+	if (failed > 1 && written) {
+		for (i=disks; i--; ) {
+			if (sh->bh_written[i]) written--;
+			while ((bh = sh->bh_written[i])) {
+				sh->bh_written[i] = bh->b_reqnext;
+				bh->b_reqnext = return_fail;
+				return_fail = bh;
+			}
+		}
+	}
+
 	/* Now we might consider reading some blocks, either to check/generate
 	 * parity, or to satisfy requests
 	 */