aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/raid5.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 4616bc3a6e71..3c3626d2a1f9 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3811,13 +3811,13 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped
3811 safepos = conf->reshape_safe; 3811 safepos = conf->reshape_safe;
3812 sector_div(safepos, data_disks); 3812 sector_div(safepos, data_disks);
3813 if (mddev->delta_disks < 0) { 3813 if (mddev->delta_disks < 0) {
3814 writepos -= reshape_sectors; 3814 writepos -= min(reshape_sectors, writepos);
3815 readpos += reshape_sectors; 3815 readpos += reshape_sectors;
3816 safepos += reshape_sectors; 3816 safepos += reshape_sectors;
3817 } else { 3817 } else {
3818 writepos += reshape_sectors; 3818 writepos += reshape_sectors;
3819 readpos -= reshape_sectors; 3819 readpos -= min(reshape_sectors, readpos);
3820 safepos -= reshape_sectors; 3820 safepos -= min(reshape_sectors, safepos);
3821 } 3821 }
3822 3822
3823 /* 'writepos' is the most advanced device address we might write. 3823 /* 'writepos' is the most advanced device address we might write.