• Mike Anderson's avatar
    [PATCH] scsi device ref count (update) · e4df9910
    Mike Anderson authored
    This patch is against scsi-bugfixes-2.6. I updated it based on comments
    received. It breaks up the reference count initialization for scsi_device
    and restores calling slave_destroy for all scsi_devices configured or
    not. I ran a small regression using the scsi_debug, aic7xxx, and qla2xxx
    driver. I also had a debug patch for more verbose kobject cleanup and
    patch for a badness check on atomic_dec going negative (previously
    provided by Linus).
    
    The object cleanup appears to being functioning correctly. I only saw
    previously reported badness output:
    	- Synchronizing SCSI cache fails on cleanup.
    	- scsi_debug.c missing release (I believe Doug posted a patch)
    	- aic7xxx warnings on rmmod due to ahc_platform_free calling
    	  scsi_remove_host with ahc_list_lock held.
    
    
    This patch splits the scsi device struct device register into init and
    add. It also addresses memory leak issues of not calling slave_destroy
    on scsi_devices that are not configured in.
    
    Details:
    * Make scsi_device_dev_release extern for scsi_scan to use in
    alloc_sdev.
    * Move scsi_free_sdev code to scsi_device_dev_release. Have
    previous callers of scsi_free_sdev call slave_destroy plus put_device.
    * Changed name of scsi_device_register to scsi_sysfs_add_sdev to
    match host call and align with split struct device init.
    * Move sdev_gendev device and class init to scsi_alloc_sdev.
    
    Thu Nov 20 22:56:11 PST 2003
    
     drivers/scsi/scsi_priv.h  |    4 +-
     drivers/scsi/scsi_scan.c  |   63 +++++++++++++++++++++-------------------------
     drivers/scsi/scsi_sysfs.c |   58 ++++++++++++++++++++++--------------------
     3 files changed, 62 insertions(+), 63 deletions(-)
    e4df9910
scsi_priv.h 4.9 KB