From: Jun'ichi Nomura <[email-masked]>

If we hold a bdev inode for a suspended device
when freeing it, we must call bdput first.

Signed-off-by: Jun'ichi Nomura <[email-masked]>
Signed-Off-By: Alasdair G Kergon <[email-masked]>

Index: linux-2.6.16-rc1/drivers/md/dm.c
===================================================================
--- linux-2.6.16-rc1.orig/drivers/md/dm.c	2006-03-01 21:40:30.000000000 +0000
+++ linux-2.6.16-rc1/drivers/md/dm.c	2006-03-01 21:42:55.000000000 +0000
@@ -849,6 +849,10 @@ static struct mapped_device *alloc_dev(u
 
 static void free_dev(struct mapped_device *md)
 {
+	if (md->suspended_bdev) {
+		thaw_bdev(md->suspended_bdev, NULL);
+		bdput(md->suspended_bdev);
+	}
 	free_minor(md->disk->first_minor);
 	mempool_destroy(md->tio_pool);
 	mempool_destroy(md->io_pool);