Commit c4ff687d authored by Don Brace's avatar Don Brace Committed by Martin K. Petersen

scsi: smartpqi: Fix rmmod stack trace

Prevent "BUG: scheduling while atomic: rmmod" stack trace.

Stop setting spin_locks before calling OS functions to remove devices.

Link: https://lore.kernel.org/r/164375207296.440833.4996145011193819683.stgit@brunhilda.pdev.netReviewed-by: default avatarScott Benesh <scott.benesh@microchip.com>
Reviewed-by: default avatarScott Teel <scott.teel@microchip.com>
Reviewed-by: default avatarKevin Barnett <kevin.barnett@microchip.com>
Signed-off-by: default avatarDon Brace <don.brace@microchip.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent d20b3dae
...@@ -2513,17 +2513,15 @@ static void pqi_remove_all_scsi_devices(struct pqi_ctrl_info *ctrl_info) ...@@ -2513,17 +2513,15 @@ static void pqi_remove_all_scsi_devices(struct pqi_ctrl_info *ctrl_info)
struct pqi_scsi_dev *device; struct pqi_scsi_dev *device;
struct pqi_scsi_dev *next; struct pqi_scsi_dev *next;
spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags);
list_for_each_entry_safe(device, next, &ctrl_info->scsi_device_list, list_for_each_entry_safe(device, next, &ctrl_info->scsi_device_list,
scsi_device_list_entry) { scsi_device_list_entry) {
if (pqi_is_device_added(device)) if (pqi_is_device_added(device))
pqi_remove_device(ctrl_info, device); pqi_remove_device(ctrl_info, device);
spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags);
list_del(&device->scsi_device_list_entry); 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);
} }
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