alistair23-linux/drivers/md/persistent-data
Joe Thornber f046f89a99 dm thin: fix discard corruption
Fix a bug in dm_btree_remove that could leave leaf values with incorrect
reference counts.  The effect of this was that removal of a shared block
could result in the space maps thinking the block was no longer used.
More concretely, if you have a thin device and a snapshot of it, sending
a discard to a shared region of the thin could corrupt the snapshot.

Thinp uses a 2-level nested btree to store it's mappings.  This first
level is indexed by thin device, and the second level by logical
block.

Often when we're removing an entry in this mapping tree we need to
rebalance nodes, which can involve shadowing them, possibly creating a
copy if the block is shared.  If we do create a copy then children of
that node need to have their reference counts incremented.  In this
way reference counts percolate down the tree as shared trees diverge.

The rebalance functions were incrementing the children at the
appropriate time, but they were always assuming the children were
internal nodes.  This meant the leaf values (in our case packed
block/flags entries) were not being incremented.

Cc: stable@vger.kernel.org
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
2013-03-20 17:21:24 +00:00
..
dm-array.c dm persistent data: add transactional array 2013-03-01 22:45:51 +00: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: add cache target 2013-03-01 22:45:51 +00:00
dm-block-manager.h dm persistent data: introduce dm_bm_set_read_only 2012-07-27 15:08:15 +01: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 persistent data: add btree_walk 2013-03-01 22:45:50 +00:00
dm-btree.h dm persistent data: add btree_walk 2013-03-01 22:45:50 +00:00
dm-persistent-data-internal.h dm: add persistent data library 2011-10-31 20:19:11 +00:00
dm-space-map-common.c dm persistent data: use DMERR_LIMIT for errors 2012-12-21 20:23:34 +00: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 persistent data: remove debug space map checker 2012-07-27 15:07:58 +01:00
dm-space-map-disk.h dm: add persistent data library 2011-10-31 20:19:11 +00:00
dm-space-map-metadata.c dm persistent data: improve improve space map block alloc failure message 2012-12-21 20:23:36 +00:00
dm-space-map-metadata.h dm: add persistent data library 2011-10-31 20:19:11 +00:00
dm-space-map.h dm: add persistent data library 2011-10-31 20:19:11 +00: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
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