提交 848b3182 编写于 作者: N NeilBrown

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: NNeilBrown <neilb@suse.de>
上级 b6a9ce68
......@@ -3811,13 +3811,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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册