From: NeilBrown Date: Thu, 22 Dec 2011 23:17:54 +0000 (+1100) Subject: md/raid5: Mark device want_replacement when we see a write error. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3a6de2924af602f9c1b5a5154438c37f2d712dfa;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git md/raid5: Mark device want_replacement when we see a write error. Now that WantReplacement drives are replaced cleanly, mark a drive as WantReplacement when we see a write error. It might get failed soon so the WantReplacement flag is irrelevant, but if the write error is recorded in the bad block log, we still want to activate any spare that might be available. Reviewed-by: Dan Williams Signed-off-by: NeilBrown --- diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index b2c83859f75b..360f2b98f62b 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -1796,6 +1796,9 @@ static void raid5_end_write_request(struct bio *bi, int error) if (!uptodate) { set_bit(WriteErrorSeen, &rdev->flags); set_bit(R5_WriteError, &sh->dev[i].flags); + if (!test_and_set_bit(WantReplacement, &rdev->flags)) + set_bit(MD_RECOVERY_NEEDED, + &rdev->mddev->recovery); } else if (is_badblock(rdev, sh->sector, STRIPE_SECTORS, &first_bad, &bad_sectors))