[dm-devel] [PATCH-RFC] Bug in dm-raid1 as used by pvmove

Neil Brown neilb at suse.de
Tue May 9 04:55:28 UTC 2006


Hi,
 We have a report of a system oops during pvmove.

 What appears to be happening is core_in_sync is being passed
 a 'region' is which much too large.  When this is indexed into the
 bitset at lc->sync_bits it hits an unmapped page, and results in an
 oops.

 I believe the problem is in bio_to_region.  See the patch below.

 If a section of an lv which is *not* at the start of the lv is being
 moved using dm-raid1, I think the region number is being calculated
 wrongly resulting in the inappropriately large index.  We really
 need to subtract ti->begin from bi_sector before shifting.

 We will try to get this patch tested on the machine that showed the
 fault, but I would appreciate any feedback about the patch and I am
 still not very familiar with this code.

Thanks,
NeilBrown



Signed-off-by: Neil Brown <neilb at suse.de>

### Diffstat output
 ./drivers/md/dm-raid1.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff ./drivers/md/dm-raid1.c~current~ ./drivers/md/dm-raid1.c
--- ./drivers/md/dm-raid1.c~current~	2006-05-09 14:47:35.000000000 +1000
+++ ./drivers/md/dm-raid1.c	2006-05-09 14:47:35.000000000 +1000
@@ -111,7 +111,7 @@ struct region {
  */
 static inline region_t bio_to_region(struct region_hash *rh, struct bio *bio)
 {
-	return bio->bi_sector >> rh->region_shift;
+	return (bio->bi_sector - rh->ms->ti->begin) >> rh->region_shift;
 }
 
 static inline sector_t region_to_sector(struct region_hash *rh, region_t region)




More information about the dm-devel mailing list