Commit 03022c54b9725026c0370a810168975c387ad04c

Authored by Zdenek Kabelac
Committed by Alasdair G Kergon
1 parent bca915aae8

dm: add missing del_gendisk to alloc_dev error path

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>

Showing 1 changed file with 1 additions and 0 deletions Side-by-side Diff

... ... @@ -1822,6 +1822,7 @@
1822 1822 bad_bdev:
1823 1823 destroy_workqueue(md->wq);
1824 1824 bad_thread:
  1825 + del_gendisk(md->disk);
1825 1826 put_disk(md->disk);
1826 1827 bad_disk:
1827 1828 blk_cleanup_queue(md->queue);