Commit 884d5952 authored by Joe Thornber's avatar Joe Thornber Committed by Greg Kroah-Hartman

dm array: fix bug in growing array

commit 9c1d4de5 upstream.

Entries would be lost if the old tail block was partially filled.
Signed-off-by: default avatarJoe Thornber <ejt@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0cc9fcd4
...@@ -509,15 +509,18 @@ static int grow_add_tail_block(struct resize *resize) ...@@ -509,15 +509,18 @@ static int grow_add_tail_block(struct resize *resize)
static int grow_needs_more_blocks(struct resize *resize) static int grow_needs_more_blocks(struct resize *resize)
{ {
int r; int r;
unsigned old_nr_blocks = resize->old_nr_full_blocks;
if (resize->old_nr_entries_in_last_block > 0) { if (resize->old_nr_entries_in_last_block > 0) {
old_nr_blocks++;
r = grow_extend_tail_block(resize, resize->max_entries); r = grow_extend_tail_block(resize, resize->max_entries);
if (r) if (r)
return r; return r;
} }
r = insert_full_ablocks(resize->info, resize->size_of_block, r = insert_full_ablocks(resize->info, resize->size_of_block,
resize->old_nr_full_blocks, old_nr_blocks,
resize->new_nr_full_blocks, resize->new_nr_full_blocks,
resize->max_entries, resize->value, resize->max_entries, resize->value,
&resize->root); &resize->root);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment