aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorBian Yu <bianyu@kedacom.com>2013-11-13 23:16:17 -0500
committerNeilBrown <neilb@suse.de>2013-11-18 23:18:24 -0500
commitedfa1f651e93261eecb034d02284ece103dd691a (patch)
tree0a4087a7fb9a26089e99592f87bc515bbe60e789 /drivers/md
parent4bda556aea1d2916260326c6afa77b84a1f1345a (diff)
raid5: Retry R5_ReadNoMerge flag when hit a read error.
Because of block layer merge, one bio fails will cause other bios which belongs to the same request fails, so raid5_end_read_request will record all these bios as badblocks. If retry request with R5_ReadNoMerge flag to avoid bios merge, badblocks can only record sector which is bad exactly. test: hdparm --yes-i-know-what-i-am-doing --make-bad-sector 300000 /dev/sdb mdadm -C /dev/md0 -l5 -n3 /dev/sd[bcd] --assume-clean mdadm /dev/md0 -f /dev/sdd mdadm /dev/md0 -r /dev/sdd mdadm --zero-superblock /dev/sdd mdadm /dev/md0 -a /dev/sdd 1. Without this patch: cat /sys/block/md0/md/rd*/bad_blocks 299776 256 299776 256 2. With this patch: cat /sys/block/md0/md/rd*/bad_blocks 300000 8 300000 8 Signed-off-by: Bian Yu <bianyu@kedacom.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid5.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 1fb28c56457a..2c8907706109 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2056,6 +2056,9 @@ static void raid5_end_read_request(struct bio * bi, int error)
2056 mdname(conf->mddev), bdn); 2056 mdname(conf->mddev), bdn);
2057 else 2057 else
2058 retry = 1; 2058 retry = 1;
2059 if (set_bad && test_bit(In_sync, &rdev->flags)
2060 && !test_bit(R5_ReadNoMerge, &sh->dev[i].flags))
2061 retry = 1;
2059 if (retry) 2062 if (retry)
2060 if (test_bit(R5_ReadNoMerge, &sh->dev[i].flags)) { 2063 if (test_bit(R5_ReadNoMerge, &sh->dev[i].flags)) {
2061 set_bit(R5_ReadError, &sh->dev[i].flags); 2064 set_bit(R5_ReadError, &sh->dev[i].flags);