diff options
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r-- | drivers/md/dm.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index e9adeb9d172f..745ca1f67b14 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -849,10 +849,16 @@ static struct mapped_device *alloc_dev(unsigned int minor, int persistent) | |||
849 | 849 | ||
850 | static void free_dev(struct mapped_device *md) | 850 | static void free_dev(struct mapped_device *md) |
851 | { | 851 | { |
852 | free_minor(md->disk->first_minor); | 852 | unsigned int minor = md->disk->first_minor; |
853 | |||
854 | if (md->suspended_bdev) { | ||
855 | thaw_bdev(md->suspended_bdev, NULL); | ||
856 | bdput(md->suspended_bdev); | ||
857 | } | ||
853 | mempool_destroy(md->tio_pool); | 858 | mempool_destroy(md->tio_pool); |
854 | mempool_destroy(md->io_pool); | 859 | mempool_destroy(md->io_pool); |
855 | del_gendisk(md->disk); | 860 | del_gendisk(md->disk); |
861 | free_minor(minor); | ||
856 | put_disk(md->disk); | 862 | put_disk(md->disk); |
857 | blk_put_queue(md->queue); | 863 | blk_put_queue(md->queue); |
858 | kfree(md); | 864 | kfree(md); |