Skip to content

Commit

Permalink
md: Allow read error in a single drive raid1 to be passed up.
Browse files Browse the repository at this point in the history
If a raid1 only has a single working device and gets a read error, 
we choose to simply return that error up to the filesystem (or whatever)
rather than failing the whole array.

However the codes doesn't quite do that.  We attempt a readbalance
which allocates the same drive, so we retry the read - indefinitely. 

Instead:  If read_balance in the error case chooses the same drive that just
failed, treat it as a failure and don't retry.

Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
neilbrown committed Feb 6, 2009
1 parent eda58a8 commit 4706b34
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/md/raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1640,7 +1640,8 @@ static void raid1d(mddev_t *mddev)
}

bio = r1_bio->bios[r1_bio->read_disk];
if ((disk=read_balance(conf, r1_bio)) == -1) {
if ((disk=read_balance(conf, r1_bio)) == -1 ||
disk == r1_bio->read_disk) {
printk(KERN_ALERT "raid1: %s: unrecoverable I/O"
" read error for block %llu\n",
bdevname(bio->bi_bdev,b),
Expand Down

0 comments on commit 4706b34

Please sign in to comment.