RAID10 overwrites partition tables
On Friday November 27, Neil Brown wrote
Quoted 11 lines
Quoted 1 line
mdadm --level 10 does not seem to respect disk partition boundaries.
Hmmm, yes, thanks.
I think the following should fix the bug. It only affects 'resync' not normal IO or recovery (after a drive has failed).
...
diff./drivers/md/raid10.c~current~./drivers/md/raid10.c
---./drivers/md/raid10.c~current~2004-11-16 16:33:50.000000000 +1100
+++./drivers/md/raid10.c2004-11-27 11:00:06.000000000 +1100
Review static void sync_request_write(mddev_t * · line 1155
Quoted 6 lines
(quoted diff) +1
-0@@ -1150,6 +1150,7 @@ static void sync_request_write(mddev_t * md_sync_acct(conf->mirrors[d].rdev->bdev, tbio->bi_size >> 9); tbio->bi_sector += conf->mirrors[d].rdev->data_offset; + tbio->bi_bdev = conf->mirrors[d].rdev->bdev; generic_make_request(tbio); }
Thanks, the adjustments to the bio before the generic_make_request do the trick nicely.
Note that the version of raid10.c in the current Fedora 3 series does not include either of the adjustments so the patch required against that version becomes:
diff ./drivers/md/raid10.c~ ./drivers/md/raid10.c
--- ./drivers/md/raid10.c~ 2004-11-16 16:33:50.000000000 +1100
+++ ./drivers/md/raid10.c 2004-11-27 11:00:06.000000000 +1100
@@ -1145,6 +1145,8 @@
atomic_inc(&r10_bio->remaining);
md_sync_acct(conf->mirrors[d].rdev->bdev, tbio->bi_size >> 9);
+ tbio->bi_sector += conf->mirrors[d].rdev->data_offset;
+ tbio->bi_bdev = conf->mirrors[d].rdev->bdev;
generic_make_request(tbio);
}
Thanks again,
Felix
Signature · 4 lines
Whatever you Wanadoo: http://www.wanadoo.co.uk/time/ This email has been checked for most known viruses - find out more at: http://www.wanadoo.co.uk/help/id/7098.htm