* [PATCH] md/raid1:If raid1 only had one disk and readed error,should call rdev_set_badblocks().
@ 2012-04-11 3:00 majianpeng
0 siblings, 0 replies; only message in thread
From: majianpeng @ 2012-04-11 3:00 UTC (permalink / raw)
To: Neil Brown; +Cc: linux-raid
From 9d031da06c11d53a04c87ff8c497a99c0901d44b Mon Sep 17 00:00:00 2001
From: majianpeng <majianpeng@gmail.com>
Date: Wed, 11 Apr 2012 10:49:30 +0800
Subject: [PATCH] md/raid1:If raid1 only had one disk and readed error,should
call rdev_set_badblocks().
Do it can
1:record bad sector
2:If raid is recoverying and set badblocks fail,so stop the recovery.
Signed-off-by: majianpeng <majianpeng@gmail.com>
---
drivers/md/raid1.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index d35e4c9..a46ab4b 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -317,6 +317,11 @@ static void raid1_end_read_request(struct bio *bio, int error)
!test_bit(Faulty, &conf->mirrors[mirror].rdev->flags)))
uptodate = 1;
spin_unlock_irqrestore(&conf->device_lock, flags);
+ if (uptodate && !rdev_set_badblocks(conf->mirrors[mirror].rdev,
+ r1_bio->sector + conf->mirrors[mirror].rdev->data_offset,
+ r1_bio->sectors, 0))
+ md_error(conf->mddev, conf->mirrors[mirror].rdev);
+
}
if (uptodate)
--
1.7.5.4
--------------
majianpeng
2012-04-11
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2012-04-11 3:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-11 3:00 [PATCH] md/raid1:If raid1 only had one disk and readed error,should call rdev_set_badblocks() majianpeng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).