Re: [PATCH 0/6] md: More sector_t conversions -- intro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday May 26, neilb@xxxxxxx wrote:
> > 
> > All patches pass the tests of the mdadm test suite except
> > 07reshape5intr which appears fail also for the vanilla for-next tree.
> 
> Hmm... I guess I should look into that!

Yep. There is a big there.  Thanks for helping find it.

Here is the patch.

Thanks,
NeilBrown


Author: NeilBrown <neilb@xxxxxxx>
Date:   Tue May 26 12:39:27 2009 +1000

    md: raid5: avoid sector values going negative when testing reshape progress.
    
    As sector_t in unsigned, we cannot afford to let 'safepos' etc go
    negative.
    So replace
       a -= b;
    by
       a -= min(b,a);
    
    Signed-off-by: NeilBrown <neilb@xxxxxxx>

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 6b89a7e..dce7741 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3810,13 +3810,13 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped
 	safepos = conf->reshape_safe;
 	sector_div(safepos, data_disks);
 	if (mddev->delta_disks < 0) {
-		writepos -= reshape_sectors;
+		writepos -= min(reshape_sectors, writepos);
 		readpos += reshape_sectors;
 		safepos += reshape_sectors;
 	} else {
 		writepos += reshape_sectors;
-		readpos -= reshape_sectors;
-		safepos -= reshape_sectors;
+		readpos -= min(reshape_sectors, readpos);
+		safepos -= min(reshape_sectors, safepos);
 	}
 
 	/* 'writepos' is the most advanced device address we might write.
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux