linux_old1/drivers/md/persistent-data
Joe Thornber fca028438f dm space map metadata: fix bug in resizing of thin metadata
This bug was introduced in commit 7e664b3dec ("dm space map metadata:
fix extending the space map").

When extending a dm-thin metadata volume we:

- Switch the space map into a simple bootstrap mode, which allocates
  all space linearly from the newly added space.
- Add new bitmap entries for the new space
- Increment the reference counts for those newly allocated bitmap
  entries
- Commit changes to disk
- Switch back out of bootstrap mode.

But, the disk commit may allocate space itself, if so this fact will be
lost when switching out of bootstrap mode.

The bug exhibited itself as an error when the bitmap_root, with an
erroneous ref count of 0, was subsequently decremented as part of a
later disk commit.  This would cause the disk commit to fail, and thinp
to enter read_only mode.  The metadata was not damaged (thin_check
passed).

The fix is to put the increments + commit into a loop, running until
the commit has not allocated extra space.  In practise this loop only
runs twice.

With this fix the following device mapper testsuite test passes:
 dmtest run --suite thin-provisioning -n thin_remove_works_after_resize

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org # depends on commit 7e664b3dec
2014-01-21 12:15:01 -05:00
..
Kconfig dm persistent data: remove CONFIG_EXPERIMENTAL 2013-03-01 22:45:46 +00:00
Makefile dm persistent data: add bitset 2013-03-01 22:45:51 +00:00
dm-array.c dm array: fix a reference counting bug in shadow_ablock 2013-12-13 14:22:10 -05:00
dm-array.h dm persistent data: add transactional array 2013-03-01 22:45:51 +00:00
dm-bitset.c dm persistent data: add bitset 2013-03-01 22:45:51 +00:00
dm-bitset.h dm persistent data: add bitset 2013-03-01 22:45:51 +00:00
dm-block-manager.c dm persistent data: cleanup dm-thin specific references in text 2014-01-07 10:11:54 -05:00
dm-block-manager.h dm thin: allow pool in read-only mode to transition to read-write mode 2013-12-10 16:35:13 -05:00
dm-btree-internal.h dm persistent data: add btree_walk 2013-03-01 22:45:50 +00:00
dm-btree-remove.c dm thin: fix discard corruption 2013-03-20 17:21:24 +00:00
dm-btree-spine.c dm persistent data: add btree_walk 2013-03-01 22:45:50 +00:00
dm-btree.c dm btree: add dm_btree_find_lowest_key 2014-01-09 16:29:17 -05:00
dm-btree.h dm btree: add dm_btree_find_lowest_key 2014-01-09 16:29:17 -05:00
dm-persistent-data-internal.h
dm-space-map-common.c dm space map common: make sure new space is used during extend 2014-01-07 21:05:17 -05:00
dm-space-map-common.h dm persistent data: only commit space map if index changed 2012-07-27 15:08:06 +01:00
dm-space-map-disk.c dm space map disk: optimise sm_disk_dec_block 2013-11-09 18:20:24 -05:00
dm-space-map-disk.h
dm-space-map-metadata.c dm space map metadata: fix bug in resizing of thin metadata 2014-01-21 12:15:01 -05:00
dm-space-map-metadata.h
dm-space-map.h dm persistent data: add threshold callback to space map 2013-05-10 14:37:20 +01:00
dm-transaction-manager.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
dm-transaction-manager.h dm persistent data: tidy transaction manager creation fns 2012-07-27 15:08:09 +01:00