Skip to contentSkip to conversation

Make sure raid5/raid6 resync uses correct 'max_sectors'

PATCH New NeilBrown 1 participant 1 message Aug 1, 2005 1 message not in the archive MD RAID

lore
Share & tools
lore

NeilBrown

author
#1 lore raw

PATCH 1/1 Make sure raid5/raid6 resync uses correct 'max_sectors'

In reply to a message not in the archive

I'm putting together a test-suite for mdadm and md (About time), and it found this bug for me. Without it, an array creating in just the right way (i.e. the way that mdadm-v2 creates array) will resync forever.

It would be good if this went into 2.6.13

Thanks,
NeilBrown

--

The default resync_max_sector is set to "mddev->size << 1". If the raid-personality-module updates mddev->size, it must update resync_max_sectors too.

### Diffstat output

 ./drivers/md/raid5.c     |    1 +
 ./drivers/md/raid6main.c |    1 +
 2 files changed, 2 insertions(+)
drivers/md/raid5.c renamed from drivers/md/raid5.c~current~ +1 -0
diff ./drivers/md/raid5.c~current~ ./drivers/md/raid5.c
@@ -1653,6 +1653,7 @@ static int run (mddev_t *mddev)
 
 	/* device size must be a multiple of chunk size */
 	mddev->size &= ~(mddev->chunk_size/1024 -1);
+	mddev->resync_max_sectors = mddev->size << 1;
 
 	if (!conf->chunk_size || conf->chunk_size % 4) {
 		printk(KERN_ERR "raid5: invalid chunk size %d for %s\n",
drivers/md/raid6main.c renamed from drivers/md/raid6main.c~current~ +1 -0
diff ./drivers/md/raid6main.c~current~ ./drivers/md/raid6main.c
@@ -1813,6 +1813,7 @@ static int run (mddev_t *mddev)
 
 	/* device size must be a multiple of chunk size */
 	mddev->size &= ~(mddev->chunk_size/1024 -1);
+	mddev->resync_max_sectors = mddev->size << 1;
 
 	if (conf->raid_disks < 4) {
 		printk(KERN_ERR "raid6: not enough configured devices for %s (%d, minimum 4)\n",