mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-17 02:15:57 +00:00
scsi: serialize ->rescan against ->remove
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> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
This commit is contained in:
parent
4e5a800c82
commit
e27829dc92
@ -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);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user