diff options
author | Joe Thornber <ejt@redhat.com> | 2013-03-20 21:21:24 +0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2013-03-20 21:21:24 +0400 |
commit | f046f89a99ccfd9408b94c653374ff3065c7edb3 (patch) | |
tree | 1e15ad9384d7f624594db171e4038c5b5f1e485b /drivers/uwb/lc-dev.c | |
parent | a937536b868b8369b98967929045f1df54234323 (diff) | |
download | linux-f046f89a99ccfd9408b94c653374ff3065c7edb3.tar.xz |
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>
Diffstat (limited to 'drivers/uwb/lc-dev.c')
0 files changed, 0 insertions, 0 deletions