All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] scsi: serialize ->rescan against ->remove
@ 2015-02-02 13:01 Christoph Hellwig
  2015-02-02 13:01 ` [PATCH 2/3] sd: don't grab a device references from driver methods Christoph Hellwig
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Christoph Hellwig @ 2015-02-02 13:01 UTC (permalink / raw)
  To: linux-scsi; +Cc: Bart Van Assche, James Bottomley, Alan Stern

Lock the device embedded in the scsi_device to protect against
concurrent calls to ->remove.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
 drivers/scsi/scsi_scan.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 983aed1..523faee 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1593,16 +1593,15 @@ EXPORT_SYMBOL(scsi_add_device);
 
 void scsi_rescan_device(struct device *dev)
 {
-	if (!dev->driver)
-		return;
-
-	if (try_module_get(dev->driver->owner)) {
+	device_lock(dev);
+	if (dev->driver && try_module_get(dev->driver->owner)) {
 		struct scsi_driver *drv = to_scsi_driver(dev->driver);
 
 		if (drv->rescan)
 			drv->rescan(dev);
 		module_put(dev->driver->owner);
 	}
+	device_unlock(dev);
 }
 EXPORT_SYMBOL(scsi_rescan_device);
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [PATCH 1/3] scsi: serialize ->rescan against ->remove
@ 2015-01-28 23:00 Christoph Hellwig
  2015-01-28 23:00 ` [PATCH 2/3] sd: don't grab a device references from driver methods Christoph Hellwig
  0 siblings, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2015-01-28 23:00 UTC (permalink / raw)
  To: linux-scsi; +Cc: Bart Van Assche, James Bottomley, Alan Stern

Lock the device embedded in the scsi_device to protect against
concurrent calls to ->remove.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/scsi/scsi_scan.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 983aed1..523faee 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1593,16 +1593,15 @@ EXPORT_SYMBOL(scsi_add_device);
 
 void scsi_rescan_device(struct device *dev)
 {
-	if (!dev->driver)
-		return;
-
-	if (try_module_get(dev->driver->owner)) {
+	device_lock(dev);
+	if (dev->driver && try_module_get(dev->driver->owner)) {
 		struct scsi_driver *drv = to_scsi_driver(dev->driver);
 
 		if (drv->rescan)
 			drv->rescan(dev);
 		module_put(dev->driver->owner);
 	}
+	device_unlock(dev);
 }
 EXPORT_SYMBOL(scsi_rescan_device);
 
-- 
1.9.1


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

end of thread, other threads:[~2015-04-29 13:28 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-02 13:01 [PATCH 1/3] scsi: serialize ->rescan against ->remove Christoph Hellwig
2015-02-02 13:01 ` [PATCH 2/3] sd: don't grab a device references from driver methods Christoph Hellwig
2015-03-10 16:21   ` Hannes Reinecke
2015-02-02 13:01 ` [PATCH 3/3] scsi: proper state checking and module refcount handling in scsi_device_get Christoph Hellwig
2015-03-05 13:36   ` Paolo Bonzini
2015-03-10 16:22   ` Hannes Reinecke
2015-04-29  1:17   ` Akinobu Mita
2015-04-29 13:27     ` Christoph Hellwig
2015-03-05 13:33 ` [PATCH 1/3] scsi: serialize ->rescan against ->remove Christoph Hellwig
2015-03-05 13:37   ` Paolo Bonzini
2015-03-16 17:29     ` Paolo Bonzini
2015-03-05 13:36 ` Paolo Bonzini
2015-03-10 16:20 ` Hannes Reinecke
  -- strict thread matches above, loose matches on Subject: below --
2015-01-28 23:00 Christoph Hellwig
2015-01-28 23:00 ` [PATCH 2/3] sd: don't grab a device references from driver methods Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.