public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v7] scsi: ufs & esp_scsi: fix module reference counting
@ 2015-05-11 13:18 Akinobu Mita
  2015-05-11 13:18 ` [PATCH v7] scsi: ufs: fix module reference for scsi host Akinobu Mita
  2015-05-11 13:18 ` [PATCH v7] scsi: esp_scsi: " Akinobu Mita
  0 siblings, 2 replies; 3+ messages in thread
From: Akinobu Mita @ 2015-05-11 13:18 UTC (permalink / raw)
  To: linux-scsi
  Cc: Akinobu Mita, Vinayak Holikatti, Dolev Raviv, Sujit Reddy Thumma,
	Subhash Jadavani, Christoph Hellwig, James E.J. Bottomley,
	Matthew Dharm, Greg Kroah-Hartman, Alan Stern, David S. Miller,
	Hannes Reinecke

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 and esp scsi drivers.  These drivers consist with core
driver and actual LLDDs, and scsi_host_template is defined in the core
driver.  Since the module reference count isn't incremented, the
actual LLDDs can be unloaded while the scsi_device is being accessed.

This fixes it by preparing scsi host template for each LLDDs, which
is initialized at module_init().

* v7:
- Patch series is almost rewritten again and no scsi mid layer change
  anymore.  This fixes the issue by preparing scsi host template for
  each LLDDs, which is initialized at module_init(). 
  The idea is provided by James Bottomley
- The patch for usb-storage was removed as it was added to usb-testing

* v6:
- Rebased as v5 doesn't apply cleanly to the latest tree anymore.

* v5:
- Discard v4 changes and restore to v3.  Because v4 shows that
  moving owner module field from scsi_host_template to Scsi_Host
  requires a lot of changes and introduces complication to existing
  drivers which don't have the module reference mismatch issue.
- Rebased to the 4.0-rc1

* v4:
- Patch series is almost rewritten as module reference field in
  struct scsi_host_template has been unused anymore.  So Acked-by: and
  Reviewed-by: tags that have been received are deleted.

* 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 (2):
  scsi: ufs: fix module reference for scsi host
  scsi: esp_scsi: fix module reference for scsi host

 drivers/scsi/am53c974.c          |  7 +++++--
 drivers/scsi/esp_scsi.c          | 13 +++++++++++--
 drivers/scsi/esp_scsi.h          |  9 +++++++--
 drivers/scsi/jazz_esp.c          |  7 +++++--
 drivers/scsi/mac_esp.c           |  7 +++++--
 drivers/scsi/sun3x_esp.c         |  7 +++++--
 drivers/scsi/sun_esp.c           |  7 +++++--
 drivers/scsi/ufs/ufshcd-pci.c    | 19 +++++++++++++++++--
 drivers/scsi/ufs/ufshcd-pltfrm.c | 19 +++++++++++++++++--
 drivers/scsi/ufs/ufshcd.c        | 19 +++++++++++++++----
 drivers/scsi/ufs/ufshcd.h        |  5 ++++-
 11 files changed, 96 insertions(+), 23 deletions(-)

Cc: Vinayak Holikatti <vinholikatti@gmail.com>
Cc: Dolev Raviv <draviv@codeaurora.org>
Cc: Sujit Reddy Thumma <sthumma@codeaurora.org>
Cc: Subhash Jadavani <subhashj@codeaurora.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Hannes Reinecke <hare@suse.de>
Cc: linux-scsi@vger.kernel.org
-- 
1.9.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-11 13:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-11 13:18 [PATCH v7] scsi: ufs & esp_scsi: fix module reference counting Akinobu Mita
2015-05-11 13:18 ` [PATCH v7] scsi: ufs: fix module reference for scsi host Akinobu Mita
2015-05-11 13:18 ` [PATCH v7] scsi: esp_scsi: " Akinobu Mita

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox