dm: add missing del_gendisk to alloc_dev error path
authorZdenek Kabelac <zkabelac@redhat.com>
Fri, 16 Oct 2009 22:18:15 +0000 (23:18 +0100)
committerAlasdair G Kergon <agk@redhat.com>
Fri, 16 Oct 2009 22:18:15 +0000 (23:18 +0100)
Add missing del_gendisk() to error path when creation of workqueue fails.
Otherwice there is a resource leak and following warning is shown:

WARNING: at fs/sysfs/dir.c:487 sysfs_add_one+0xc5/0x160()
sysfs: cannot create duplicate filename '/devices/virtual/block/dm-0'

Cc: stable@kernel.org
Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
Reviewed-by: Jonathan Brassow <jbrassow@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm.c

index 376f1ab48a245fcdce521bd55a7ceb109f7f8c9e..c5f9918dab24f5151458033a4c786d18b31d0c56 100644 (file)
@@ -1822,6 +1822,7 @@ static struct mapped_device *alloc_dev(int minor)
 bad_bdev:
        destroy_workqueue(md->wq);
 bad_thread:
+       del_gendisk(md->disk);
        put_disk(md->disk);
 bad_disk:
        blk_cleanup_queue(md->queue);