dm space map common: make sure new space is used during extend
authorJoe Thornber <ejt@redhat.com>
Tue, 7 Jan 2014 15:47:59 +0000 (15:47 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Feb 2014 21:50:17 +0000 (13:50 -0800)
commit650afddad9fefe54cc3a3daf4cb7b21b172294db
treec5b29ce993d3adbf60109b0dd0122614c72f6530
parent7cc8d93049998a20834b50fd4a7bd0f14feb59b3
dm space map common: make sure new space is used during extend

commit 12c91a5c2d2a8e8cc40a9552313e1e7b0a2d9ee3 upstream.

When extending a low level space map we should update nr_blocks at
the start so the new space is used for the index entries.

Otherwise extend can fail, e.g.: sm_metadata_extend call sequence
that fails:
 -> sm_ll_extend
    -> dm_tm_new_block -> dm_sm_new_block -> sm_bootstrap_new_block
    => returns -ENOSPC because smm->begin == smm->ll.nr_blocks

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>
drivers/md/persistent-data/dm-space-map-common.c