aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2007-08-12 00:17:07 +0200
committerAdrian Bunk <bunk@stusta.de>2007-08-12 00:17:07 +0200
commit1da6843b983e8bebefa78f15e433320c56c27477 (patch)
tree19822cecaefd5a40f5e6948578e653002782e38d
parentb331e968763e6509255a26dcf8b40aaa17c9d02a (diff)
downloadlinux-linaro-stable-1da6843b983e8bebefa78f15e433320c56c27477.tar.gz
md: Don't clear bits in bitmap when writing to one device fails during recovery
Currently a device failure during recovery leaves bits set in the bitmap. This normally isn't a problem as the offending device will be rejected because of errors. However if device re-adding is being used with non-persistent bitmaps, this can be a problem. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Adrian Bunk <bunk@kernel.org>
-rw-r--r--drivers/md/raid1.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 31e872eb0b92..0a01a0cbd88a 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1138,8 +1138,19 @@ static int end_sync_write(struct bio *bio, unsigned int bytes_done, int error)
mirror = i;
break;
}
- if (!uptodate)
+ if (!uptodate) {
+ int sync_blocks = 0;
+ sector_t s = r1_bio->sector;
+ long sectors_to_go = r1_bio->sectors;
+ /* make sure these bits doesn't get cleared. */
+ do {
+ bitmap_end_sync(mddev->bitmap, r1_bio->sector,
+ &sync_blocks, 1);
+ s += sync_blocks;
+ sectors_to_go -= sync_blocks;
+ } while (sectors_to_go > 0);
md_error(mddev, conf->mirrors[mirror].rdev);
+ }
update_head_pos(mirror, r1_bio);