• Mike Anderson's avatar
    [PATCH] Add release function to sd for scsi_disk structure · f7ad2011
    Mike Anderson authored
    This patch removes the delay in calling device_del on the sdev struct
    device during a surprise removal event. Reference counting functions for
    sd's scsi_disk structure where also added to fix issues of unregistering
    when a sd is open.
    
    I have tested this patch using scsi_debug with differnt combinations of
    adds / removes. I mounted both partitioned and un-partitioned sd disks,
    remove the host, and then did a umount. The ref count debug output shows
    the objects staying in place prior to the umount and cleaning up once
    the umount is called.
    
    This patch fixes an issue with a delayed call of device_del on the
    sdev_gendev struct device.
    	- Remove the delayed call to device_del.
    	- Add kobject to sd scsi_disk structure.
    	- Add release function for scsi_disk kobject.
    	- Add get / put functions for scsi_disk and calls to these
    	  functions.
    
     drivers/scsi/scsi.c       |    4 --
     drivers/scsi/scsi_sysfs.c |    3 --
     drivers/scsi/sd.c         |   63 ++++++++++++++++++++++++++++++++++++++++------
     3 files changed, 57 insertions(+), 13 deletions(-)
    f7ad2011
sd.c 40.9 KB