Commit e27829dc authored by Christoph Hellwig's avatar Christoph Hellwig Committed by James Bottomley

scsi: serialize ->rescan against ->remove

Lock the device embedded in the scsi_device to protect against
concurrent calls to ->remove.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 4e5a800c
...@@ -1570,16 +1570,15 @@ EXPORT_SYMBOL(scsi_add_device); ...@@ -1570,16 +1570,15 @@ EXPORT_SYMBOL(scsi_add_device);
void scsi_rescan_device(struct device *dev) void scsi_rescan_device(struct device *dev)
{ {
if (!dev->driver) device_lock(dev);
return; if (dev->driver && try_module_get(dev->driver->owner)) {
if (try_module_get(dev->driver->owner)) {
struct scsi_driver *drv = to_scsi_driver(dev->driver); struct scsi_driver *drv = to_scsi_driver(dev->driver);
if (drv->rescan) if (drv->rescan)
drv->rescan(dev); drv->rescan(dev);
module_put(dev->driver->owner); module_put(dev->driver->owner);
} }
device_unlock(dev);
} }
EXPORT_SYMBOL(scsi_rescan_device); EXPORT_SYMBOL(scsi_rescan_device);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment