From: Anton Vorontsov Because add_disk() getting driverfs_dev twice but putting it only once, ide-{disk,cd,floppy} should put_device() themselfs. This is workaround for the bug found in genhd, which causes deadlock in ide_unregister() at wait_for_completion(&drive->gendev_rel_comp) after device_unregister(&drive->gendev). That happens by reason of ide-probe.c:drive_release_dev() not called because of driverfs_dev (which is drive->gendev) still referenced by add_disk(). Index: drivers/ide/ide-cd.c =================================================================== RCS file: /cvs/linux/kernel26/drivers/ide/ide-cd.c,v retrieving revision 1.21 diff -u -p -b -B -r1.21 ide-cd.c --- drivers/ide/ide-cd.c 23 Aug 2006 18:35:05 -0000 1.21 +++ drivers/ide/ide-cd.c 18 Oct 2006 21:18:52 -0000 @@ -3240,6 +3240,7 @@ static void ide_cd_release(struct kref * blk_queue_prep_rq(drive->queue, NULL); g->private_data = NULL; put_disk(g); + put_device(&drive->gendev); kfree(info); } Index: drivers/ide/ide-disk.c =================================================================== RCS file: /cvs/linux/kernel26/drivers/ide/ide-disk.c,v retrieving revision 1.19 diff -u -p -b -B -r1.19 ide-disk.c --- drivers/ide/ide-disk.c 23 Aug 2006 18:35:05 -0000 1.19 +++ drivers/ide/ide-disk.c 18 Oct 2006 21:18:52 -0000 @@ -1021,6 +1021,7 @@ static void ide_disk_release(struct kref drive->devfs_name[0] = '\0'; g->private_data = NULL; put_disk(g); + put_device(&drive->gendev); kfree(idkp); } Index: drivers/ide/ide-floppy.c =================================================================== RCS file: /cvs/linux/kernel26/drivers/ide/ide-floppy.c,v retrieving revision 1.16 diff -u -p -b -B -r1.16 ide-floppy.c --- drivers/ide/ide-floppy.c 23 Aug 2006 18:35:05 -0000 1.16 +++ drivers/ide/ide-floppy.c 18 Oct 2006 21:18:52 -0000 @@ -1893,6 +1893,7 @@ static void ide_floppy_release(struct kr drive->driver_data = NULL; g->private_data = NULL; put_disk(g); + put_device(&drive->gendev); kfree(floppy); }