• Linus Torvalds's avatar
    Revert "[BLOCK] Fix oops on removal of SD/MMC card" · 1a2acc9e
    Linus Torvalds authored
    This reverts commit 56cf6504.
    
    Both Erik Mouw and Andrew Vasquez independently pinpointed this commit
    as causing problems, where the slab cache for a driver is never released
    (most obviously causing problems when immediately re-loading that
    driver, resulting in a "kmem_cache_create: duplicate cache <xyz>"
    message, but it can also cause other trouble).
    
    James Bottomley dug into it, and reports:
    
      "OK, here's the scoop.  The problem patch adds a get of driverfs_dev in
       add_disk(), but doesn't put it again until disk_release() (which occurs
       on final put_disk() of the gendisk).
    
       However, in SCSI, the driverfs_dev is the sdev_gendev.  That means
       there's a reference held on sdev_gendev  until final disk put.
       Unfortunately, we use the driver model driver_remove to trigger
       del_gendisk (which removes the gendisk from visibility and decrements
       the refcount), so we've introduced an unbreakable deadlock in the
       reference counting with this.
    
       I suggest simply reversing this patch at the moment.  If Russell and
       Jens can tell me what they're trying to do I'll see if there's another
       way to do it."
    
    so hereby the patch gets reverted, waiting for a better fix.
    
    Cc: Jens Axboe <axboe@suse.de>
    Cc: Russell King <rmk@arm.linux.org.uk>
    Cc: James Bottomley <James.Bottomley@SteelEye.com>
    Cc: Erik Mouw <erik@harddisk-recovery.com>
    Cc: Andrew Vasquez <andrew.vasquez@qlogic.com>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    1a2acc9e
genhd.c 16.7 KB