Skip to contentSkip to conversation

scsi device ref count (update)

PATCH New Mike Anderson 1 participant 1 message Nov 21, 2003 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi device ref count (update)

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.

-andmike
--
Michael Anderson
[email protected]

DESC
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
EDESC

 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(-)
drivers/scsi/scsi_priv.h renamed from drivers/scsi/scsi_priv.h~sdev_ldm_reg +2 -2
diff -puN drivers/scsi/scsi_priv.h~sdev_ldm_reg drivers/scsi/scsi_priv.h
@@ -130,7 +130,6 @@ extern void scsi_exit_procfs(void);
 extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int,
 				   unsigned int, unsigned int, int);
 extern void scsi_forget_host(struct Scsi_Host *);
-extern void scsi_free_sdev(struct scsi_device *);
 extern void scsi_rescan_device(struct device *);
 
 /* scsi_sysctl.c */
@@ -143,7 +142,8 @@ extern void scsi_exit_sysctl(void);
 #endif /* CONFIG_SYSCTL */
 
 /* scsi_sysfs.c */
-extern int scsi_device_register(struct scsi_device *);
+extern void scsi_device_dev_release(struct device *);
+extern int scsi_sysfs_add_sdev(struct scsi_device *);
 extern int scsi_sysfs_add_host(struct Scsi_Host *);
 extern int scsi_sysfs_register(void);
 extern void scsi_sysfs_unregister(void);
drivers/scsi/scsi_scan.c renamed from drivers/scsi/scsi_scan.c~sdev_ldm_reg +29 -34

91 lines not on this page · raw message

drivers/scsi/scsi_sysfs.c renamed from drivers/scsi/scsi_sysfs.c~sdev_ldm_reg +31 -27

94 lines not on this page · raw message

_