Skip to contentSkip to conversation

md: Fix for raid6 reshape.

PATCH In review NeilBrown 3 participants 5 messages Mar 2, 2007 – Mar 6, 2007 1 message not in the archive MD RAID

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20070302155626.19014.patches@notabene

NeilBrown

author
#1 lore raw

PATCH 1/1 md: Fix for raid6 reshape.

### Comments for Changeset

Recent patch for raid6 reshape had a change missing that showed up in subsequent review.

Many places in the raid5 code used "conf->raid_disks-1" to mean "number of data disks". With raid6 that had to be changed to "conf->raid_disk - conf->max_degraded" or similar. One place was missed.

This bug means that if a raid6 reshape were aborted in the middle the recorded position would be wrong. On restart it would either fail (as the position wasn't on an appropriate boundary) or would leave a section of the array unreshaped, causing data corruption.

### Diffstat output

 ./drivers/md/raid5.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid5.c +1 -1
diff .prev/drivers/md/raid5.c ./drivers/md/raid5.c
@@ -3071,7 +3071,7 @@ static sector_t reshape_request(mddev_t 
 		release_stripe(sh);
 	}
 	spin_lock_irq(&conf->device_lock);
-	conf->expand_progress = (sector_nr + i)*(conf->raid_disks-1);
+	conf->expand_progress = (sector_nr + i) * new_data_disks);
 	spin_unlock_irq(&conf->device_lock);
 	/* Ok, those stripe are ready. We can start scheduling
 	 * reads on the source stripes.
#2 lore raw

drivers/md/raid5.c static sector_t reshape_request(mddev_t · line 3074

Quoted 2 lines · On Fri, 2 Mar 2007 15:56:55 +1100 NeilBrown <[email protected]> wrote:
drivers/md/raid5.c +1 -1
-	conf->expand_progress = (sector_nr + i)*(conf->raid_disks-1);
+	conf->expand_progress = (sector_nr + i) * new_data_disks);

ahem.

author
#3 lore raw
Quoted 6 lines · On Thursday March 1, [email protected] wrote:

drivers/md/raid5.c static sector_t reshape_request(mddev_t · line 3074

Quoted 2 lines · On Fri, 2 Mar 2007 15:56:55 +1100 NeilBrown <[email protected]> wrote:
drivers/md/raid5.c +1 -1
-	conf->expand_progress = (sector_nr + i)*(conf->raid_disks-1);
+	conf->expand_progress = (sector_nr + i) * new_data_disks);

ahem.

It wasn't like that when I tested it, honest...
But the original got caught up with some other changes which were not really related so I removed them all and just made this change manually.... and totally messed it up (again). Sorry.

Of course it should be

Quoted 1 line

Review

Quoted 1 line
(quoted diff) +1 -0
+	conf->expand_progress = (sector_nr + i) * new_data_disks;

NeilBrown

#4 lore raw
Quoted 17 lines · Neil Brown
Quoted 8 lines · On Thursday March 1, [email protected] wrote:

drivers/md/raid5.c static sector_t reshape_request(mddev_t · line 3074

Quoted 3 lines · On Fri, 2 Mar 2007 15:56:55 +1100 NeilBrown <[email protected]> wrote:
drivers/md/raid5.c +1 -1
-	conf->expand_progress = (sector_nr + i)*(conf->raid_disks-1);
+	conf->expand_progress = (sector_nr + i) * new_data_disks);

ahem.

It wasn't like that when I tested it, honest...
But the original got caught up with some other changes which were not really related so I removed them all and just made this change manually.... and totally messed it up (again). Sorry.

Quoted 5 lines

Of course it should be

Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +1 -0
+	conf->expand_progress = (sector_nr + i) * new_data_disks;

Will the (real) fix be in 2.6.21?

Signature · 3 lines
bill davidsen <[email protected]>
 CTO TMR Associates, Inc
 Doing interesting things with small computers since 1979
author
#5 lore raw
Quoted 4 lines · On Friday March 2, [email protected] wrote:
Quoted 3 lines
Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +1 -0
+	conf->expand_progress = (sector_nr + i) * new_data_disks;

Will the (real) fix be in 2.6.21?

It is now in Linus' git tree, so yes.

NeilBrown