mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-29 05:12:59 +01: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 <[email protected]> Acked-by: Alan Stern <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: James Bottomley <[email protected]>
This commit is contained in:
1 parent
4e5a800c82
commit
e27829dc92
1 file changed
+3
-4
@@ -1570,16 +1570,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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user