Re: [PATCH v3 0/4] scsi: ufs ums-* esp_scsi: fix module reference counting
2015-01-12 18:36 GMT+09:00 Christoph Hellwig h...@lst.de: On Sun, Jan 11, 2015 at 10:50:02PM +0900, Akinobu Mita wrote: While accessing a scsi_device, the use count of the underlying LLDD module is incremented. The module reference is retrieved through .module field of struct scsi_host_template. This mapping between scsi_device and underlying LLDD module works well except ufs, unusual usb storage drivers, and sub drivers for esp_scsi. These drivers consist with core driver and actual LLDDs, and scsi_host_template is defined in the core driver. So the actual LLDDs can be unloaded even if the scsi_device is being accessed. This patch series first adds ability to adjust module reference for scsi host by LLDDs and then fixes actual LLDDs by adjusting module reference after scsi host allocation. Why don't we move the module into the Scsi_Host only, and use the same macro that passes THIS_MODULE trick you are using in the sub drivers? That seems to be a fairly common scheme in other subsystems as well. Sure, we can take this approach. But ata drivers require more changes for it because ata drivers don't call scsi_host_alloc() directly so we need to pass THIS_MODULE to a variety of init functions() provided by libata. While looking through ata drivers, I found that libahci_platform sub-drivers and pata_of_platform driver also have module reference mismatch problem. So ata drivers need to be touched anyway. I'll update this patch series with the new approach. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 0/4] scsi: ufs ums-* esp_scsi: fix module reference counting
On Sun, Jan 11, 2015 at 10:50:02PM +0900, Akinobu Mita wrote: While accessing a scsi_device, the use count of the underlying LLDD module is incremented. The module reference is retrieved through .module field of struct scsi_host_template. This mapping between scsi_device and underlying LLDD module works well except ufs, unusual usb storage drivers, and sub drivers for esp_scsi. These drivers consist with core driver and actual LLDDs, and scsi_host_template is defined in the core driver. So the actual LLDDs can be unloaded even if the scsi_device is being accessed. This patch series first adds ability to adjust module reference for scsi host by LLDDs and then fixes actual LLDDs by adjusting module reference after scsi host allocation. Why don't we move the module into the Scsi_Host only, and use the same macro that passes THIS_MODULE trick you are using in the sub drivers? That seems to be a fairly common scheme in other subsystems as well. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 0/4] scsi: ufs ums-* esp_scsi: fix module reference counting
While accessing a scsi_device, the use count of the underlying LLDD module is incremented. The module reference is retrieved through .module field of struct scsi_host_template. This mapping between scsi_device and underlying LLDD module works well except ufs, unusual usb storage drivers, and sub drivers for esp_scsi. These drivers consist with core driver and actual LLDDs, and scsi_host_template is defined in the core driver. So the actual LLDDs can be unloaded even if the scsi_device is being accessed. This patch series first adds ability to adjust module reference for scsi host by LLDDs and then fixes actual LLDDs by adjusting module reference after scsi host allocation. * v3: - Add fix for ESP SCSI drivers * v2: - Pass correct module reference to usb_stor_probe1() instead of touching all ums-* drivers, suggested by Alan Stern Akinobu Mita (4): scsi: add ability to adjust module reference for scsi host scsi: ufs: adjust module reference for scsi host usb: storage: adjust module reference for scsi host scsi: esp_scsi: adjust module reference for scsi host drivers/scsi/am53c974.c | 3 +-- drivers/scsi/esp_scsi.c | 16 +--- drivers/scsi/esp_scsi.h | 11 +++ drivers/scsi/hosts.c | 1 + drivers/scsi/jazz_esp.c | 3 +-- drivers/scsi/mac_esp.c | 3 +-- drivers/scsi/scsi.c | 4 ++-- drivers/scsi/sun3x_esp.c | 3 +-- drivers/scsi/sun_esp.c | 3 +-- drivers/scsi/ufs/ufshcd-pci.c| 1 + drivers/scsi/ufs/ufshcd-pltfrm.c | 1 + drivers/scsi/ufs/ufshcd.c| 1 - drivers/usb/storage/usb.c| 8 +--- drivers/usb/storage/usb.h| 7 +-- include/scsi/scsi_host.h | 1 + 15 files changed, 41 insertions(+), 25 deletions(-) Cc: Vinayak Holikatti vinholika...@gmail.com Cc: Dolev Raviv dra...@codeaurora.org Cc: Sujit Reddy Thumma sthu...@codeaurora.org Cc: Subhash Jadavani subha...@codeaurora.org Cc: Christoph Hellwig h...@lst.de Cc: James E.J. Bottomley jbottom...@parallels.com Cc: Matthew Dharm mdharm-...@one-eyed-alien.net Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Alan Stern st...@rowland.harvard.edu Cc: David S. Miller da...@davemloft.net Cc: Hannes Reinecke h...@suse.de Cc: linux-...@vger.kernel.org Cc: usb-stor...@lists.one-eyed-alien.net Cc: linux-scsi@vger.kernel.org -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html