From: Mike Snitzer <[email-masked]>

Cleanup the shadow table before destroying the transaction manager.

Reference: leak was identified with kmemleak when running
test_discard_random_sectors in the thinp-test-suite.

Signed-off-by: Mike Snitzer <[email-masked]>
Cc: [email-masked]
Signed-off-by: Alasdair G Kergon <[email-masked]>

---
 drivers/md/persistent-data/dm-transaction-manager.c |    3 +++
 1 file changed, 3 insertions(+)

Index: linux-3.5-rc5/drivers/md/persistent-data/dm-transaction-manager.c
===================================================================
--- linux-3.5-rc5.orig/drivers/md/persistent-data/dm-transaction-manager.c
+++ linux-3.5-rc5/drivers/md/persistent-data/dm-transaction-manager.c
@@ -138,6 +138,9 @@ EXPORT_SYMBOL_GPL(dm_tm_create_non_block
 
 void dm_tm_destroy(struct dm_transaction_manager *tm)
 {
+	if (!tm->is_clone)
+		wipe_shadow_table(tm);
+
 	kfree(tm);
 }
 EXPORT_SYMBOL_GPL(dm_tm_destroy);