diff options
| author | Joe Thornber <ejt@redhat.com> | 2013-10-30 07:19:59 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-12-04 13:56:42 -0500 |
| commit | 0c5fd99e89b5f288ffe5c2ed301d2ffaac091891 (patch) | |
| tree | ababb36672c166f13903a2cbfb986daa2ebcf5e7 /drivers/md/persistent-data | |
| parent | 9fb1b9d041cb34f4381038e2622900dfdc4cd7b0 (diff) | |
dm array: fix bug in growing array
commit 9c1d4de56066e4d6abc66ec188faafd7b303fb08 upstream.
Entries would be lost if the old tail block was partially filled.
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md/persistent-data')
| -rw-r--r-- | drivers/md/persistent-data/dm-array.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/md/persistent-data/dm-array.c b/drivers/md/persistent-data/dm-array.c index 172147eb1d40..af96e24ec328 100644 --- a/drivers/md/persistent-data/dm-array.c +++ b/drivers/md/persistent-data/dm-array.c | |||
| @@ -509,15 +509,18 @@ static int grow_add_tail_block(struct resize *resize) | |||
| 509 | static int grow_needs_more_blocks(struct resize *resize) | 509 | static int grow_needs_more_blocks(struct resize *resize) |
| 510 | { | 510 | { |
| 511 | int r; | 511 | int r; |
| 512 | unsigned old_nr_blocks = resize->old_nr_full_blocks; | ||
| 512 | 513 | ||
| 513 | if (resize->old_nr_entries_in_last_block > 0) { | 514 | if (resize->old_nr_entries_in_last_block > 0) { |
| 515 | old_nr_blocks++; | ||
| 516 | |||
| 514 | r = grow_extend_tail_block(resize, resize->max_entries); | 517 | r = grow_extend_tail_block(resize, resize->max_entries); |
| 515 | if (r) | 518 | if (r) |
| 516 | return r; | 519 | return r; |
| 517 | } | 520 | } |
| 518 | 521 | ||
| 519 | r = insert_full_ablocks(resize->info, resize->size_of_block, | 522 | r = insert_full_ablocks(resize->info, resize->size_of_block, |
| 520 | resize->old_nr_full_blocks, | 523 | old_nr_blocks, |
| 521 | resize->new_nr_full_blocks, | 524 | resize->new_nr_full_blocks, |
| 522 | resize->max_entries, resize->value, | 525 | resize->max_entries, resize->value, |
| 523 | &resize->root); | 526 | &resize->root); |
