dm array: fix a reference counting bug in shadow_ablock
authorJoe Thornber <ejt@redhat.com>
Fri, 13 Dec 2013 14:55:55 +0000 (14:55 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Dec 2013 15:45:11 +0000 (07:45 -0800)
commit1cfc4552917a128e0cdf15f57abfe60a30f5eaec
tree9b247d08e99c49e3d1a3f87b9f861184a139deff
parent20d68d38efd83f2bb598d7b3655a5c230ccc17e8
dm array: fix a reference counting bug in shadow_ablock

commit ed9571f0cf1fe09d3506302610f3ccdfa1d22c4a upstream.

An old array block could have its reference count decremented below
zero when it is being replaced in the btree by a new array block.

The fix is to increment the old ablock's reference count just before
inserting a new ablock into the btree.

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-array.c