Commit a37ef745 authored by Kevin Barnett's avatar Kevin Barnett Committed by Martin K. Petersen

scsi: smartpqi: correct remove scsi devices

correct a problem caused by holding a spinlock during device deletion.
Reviewed-by: default avatarScott Benesh <scott.benesh@microsemi.com>
Reviewed-by: default avatarScott Teel <scott.teel@microsemi.com>
Signed-off-by: default avatarKevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: default avatarDon Brace <don.brace@microsemi.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 30c0061c
...@@ -1823,19 +1823,25 @@ static void pqi_remove_all_scsi_devices(struct pqi_ctrl_info *ctrl_info) ...@@ -1823,19 +1823,25 @@ static void pqi_remove_all_scsi_devices(struct pqi_ctrl_info *ctrl_info)
{ {
unsigned long flags; unsigned long flags;
struct pqi_scsi_dev *device; struct pqi_scsi_dev *device;
struct pqi_scsi_dev *next;
spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags); while (1) {
spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags);
device = list_first_entry_or_null(&ctrl_info->scsi_device_list,
struct pqi_scsi_dev, scsi_device_list_entry);
if (device)
list_del(&device->scsi_device_list_entry);
spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock,
flags);
if (!device)
break;
list_for_each_entry_safe(device, next, &ctrl_info->scsi_device_list,
scsi_device_list_entry) {
if (device->sdev) if (device->sdev)
pqi_remove_device(ctrl_info, device); pqi_remove_device(ctrl_info, device);
list_del(&device->scsi_device_list_entry);
pqi_free_device(device); pqi_free_device(device);
} }
spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);
} }
static int pqi_scan_scsi_devices(struct pqi_ctrl_info *ctrl_info) static int pqi_scan_scsi_devices(struct pqi_ctrl_info *ctrl_info)
......
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