mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 17:30:02 +00:00
dm btree remove: fix bug in redistribute3
redistribute3() shares entries out across 3 nodes. Some entries were being moved the wrong way, breaking the ordering. This manifested as a BUG() in dm-btree-remove.c:shift() when entries were removed from the btree. For additional context see: https://www.redhat.com/archives/dm-devel/2015-May/msg00113.html Signed-off-by: Dennis Yang <shinrairis@gmail.com> Signed-off-by: Joe Thornber <ejt@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Cc: stable@vger.kernel.org
This commit is contained in:
parent
d770e558e2
commit
4c7e309340
1 changed files with 3 additions and 3 deletions
|
@ -309,8 +309,8 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent,
|
||||||
|
|
||||||
if (s < 0 && nr_center < -s) {
|
if (s < 0 && nr_center < -s) {
|
||||||
/* not enough in central node */
|
/* not enough in central node */
|
||||||
shift(left, center, nr_center);
|
shift(left, center, -nr_center);
|
||||||
s = nr_center - target;
|
s += nr_center;
|
||||||
shift(left, right, s);
|
shift(left, right, s);
|
||||||
nr_right += s;
|
nr_right += s;
|
||||||
} else
|
} else
|
||||||
|
@ -323,7 +323,7 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent,
|
||||||
if (s > 0 && nr_center < s) {
|
if (s > 0 && nr_center < s) {
|
||||||
/* not enough in central node */
|
/* not enough in central node */
|
||||||
shift(center, right, nr_center);
|
shift(center, right, nr_center);
|
||||||
s = target - nr_center;
|
s -= nr_center;
|
||||||
shift(left, right, s);
|
shift(left, right, s);
|
||||||
nr_left -= s;
|
nr_left -= s;
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in a new issue