Skip to contentSkip to conversation

md/raid1:If raid1 only had one disk and readed error,should call rdev_set_badblocks().

PATCH New majianpeng 1 participant 1 message Apr 11, 2012 MD RAID

lore
Share & tools
lore

majianpeng

author
#0 lore raw

PATCH 1/1 md/raid1:If raid1 only had one disk and readed error,should call rdev_set_badblocks().

From 9d031da06c11d53a04c87ff8c497a99c0901d44b Mon Sep 17 00:00:00 2001
From: majianpeng <[email protected]>
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.

---
 drivers/md/raid1.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/md/raid1.c +5 -0
index d35e4c9..a46ab4b 100644
@@ -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)
Signature · 6 lines
1.7.5.4

 				
--------------
majianpeng
2012-04-11