[21/99] dm: add missing del_gendisk to alloc_dev error path

From: Greg KH
Date: Fri Nov 06 2009 - 17:40:59 EST

2.6.31-stable review patch. If anyone has any objections, please let us know.

From: Zdenek Kabelac <zkabelac@xxxxxxxxxx>

commit 03022c54b9725026c0370a810168975c387ad04c upstream.

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'

Signed-off-by: Zdenek Kabelac <zkabelac@xxxxxxxxxx>
Reviewed-by: Jonathan Brassow <jbrassow@xxxxxxxxxx>
Signed-off-by: Alasdair G Kergon <agk@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

drivers/md/dm.c | 1 +
1 file changed, 1 insertion(+)

--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1819,6 +1819,7 @@ static struct mapped_device *alloc_dev(i
+ del_gendisk(md->disk);

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/