diff options
Diffstat (limited to 'drivers/scsi/mpt2sas/mpt2sas_scsih.c')
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_scsih.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index 0c463c483c02..e3a7967259e7 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c | |||
@@ -119,7 +119,7 @@ struct sense_info { | |||
119 | */ | 119 | */ |
120 | struct fw_event_work { | 120 | struct fw_event_work { |
121 | struct list_head list; | 121 | struct list_head list; |
122 | struct delayed_work work; | 122 | struct work_struct work; |
123 | struct MPT2SAS_ADAPTER *ioc; | 123 | struct MPT2SAS_ADAPTER *ioc; |
124 | u8 VF_ID; | 124 | u8 VF_ID; |
125 | u8 host_reset_handling; | 125 | u8 host_reset_handling; |
@@ -516,12 +516,8 @@ _scsih_sas_device_add(struct MPT2SAS_ADAPTER *ioc, | |||
516 | handle = sas_device->handle; | 516 | handle = sas_device->handle; |
517 | parent_handle = sas_device->parent_handle; | 517 | parent_handle = sas_device->parent_handle; |
518 | sas_address = sas_device->sas_address; | 518 | sas_address = sas_device->sas_address; |
519 | if (!mpt2sas_transport_port_add(ioc, handle, parent_handle)) { | 519 | if (!mpt2sas_transport_port_add(ioc, handle, parent_handle)) |
520 | _scsih_sas_device_remove(ioc, sas_device); | 520 | _scsih_sas_device_remove(ioc, sas_device); |
521 | } else if (!sas_device->starget) { | ||
522 | mpt2sas_transport_port_remove(ioc, sas_address, parent_handle); | ||
523 | _scsih_sas_device_remove(ioc, sas_device); | ||
524 | } | ||
525 | } | 521 | } |
526 | 522 | ||
527 | /** | 523 | /** |
@@ -1203,7 +1199,9 @@ scsih_target_destroy(struct scsi_target *starget) | |||
1203 | rphy = dev_to_rphy(starget->dev.parent); | 1199 | rphy = dev_to_rphy(starget->dev.parent); |
1204 | sas_device = mpt2sas_scsih_sas_device_find_by_sas_address(ioc, | 1200 | sas_device = mpt2sas_scsih_sas_device_find_by_sas_address(ioc, |
1205 | rphy->identify.sas_address); | 1201 | rphy->identify.sas_address); |
1206 | if (sas_device) | 1202 | if (sas_device && (sas_device->starget == starget) && |
1203 | (sas_device->id == starget->id) && | ||
1204 | (sas_device->channel == starget->channel)) | ||
1207 | sas_device->starget = NULL; | 1205 | sas_device->starget = NULL; |
1208 | 1206 | ||
1209 | spin_unlock_irqrestore(&ioc->sas_device_lock, flags); | 1207 | spin_unlock_irqrestore(&ioc->sas_device_lock, flags); |
@@ -2009,8 +2007,8 @@ _scsih_fw_event_add(struct MPT2SAS_ADAPTER *ioc, struct fw_event_work *fw_event) | |||
2009 | 2007 | ||
2010 | spin_lock_irqsave(&ioc->fw_event_lock, flags); | 2008 | spin_lock_irqsave(&ioc->fw_event_lock, flags); |
2011 | list_add_tail(&fw_event->list, &ioc->fw_event_list); | 2009 | list_add_tail(&fw_event->list, &ioc->fw_event_list); |
2012 | INIT_DELAYED_WORK(&fw_event->work, _firmware_event_work); | 2010 | INIT_WORK(&fw_event->work, _firmware_event_work); |
2013 | queue_delayed_work(ioc->firmware_event_thread, &fw_event->work, 1); | 2011 | queue_work(ioc->firmware_event_thread, &fw_event->work); |
2014 | spin_unlock_irqrestore(&ioc->fw_event_lock, flags); | 2012 | spin_unlock_irqrestore(&ioc->fw_event_lock, flags); |
2015 | } | 2013 | } |
2016 | 2014 | ||
@@ -2054,7 +2052,7 @@ _scsih_fw_event_requeue(struct MPT2SAS_ADAPTER *ioc, struct fw_event_work | |||
2054 | return; | 2052 | return; |
2055 | 2053 | ||
2056 | spin_lock_irqsave(&ioc->fw_event_lock, flags); | 2054 | spin_lock_irqsave(&ioc->fw_event_lock, flags); |
2057 | queue_delayed_work(ioc->firmware_event_thread, &fw_event->work, delay); | 2055 | queue_work(ioc->firmware_event_thread, &fw_event->work); |
2058 | spin_unlock_irqrestore(&ioc->fw_event_lock, flags); | 2056 | spin_unlock_irqrestore(&ioc->fw_event_lock, flags); |
2059 | } | 2057 | } |
2060 | 2058 | ||
@@ -2863,8 +2861,9 @@ scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID, u32 reply) | |||
2863 | struct sense_info data; | 2861 | struct sense_info data; |
2864 | const void *sense_data = mpt2sas_base_get_sense_buffer(ioc, | 2862 | const void *sense_data = mpt2sas_base_get_sense_buffer(ioc, |
2865 | smid); | 2863 | smid); |
2866 | memcpy(scmd->sense_buffer, sense_data, | 2864 | u32 sz = min_t(u32, SCSI_SENSE_BUFFERSIZE, |
2867 | le32_to_cpu(mpi_reply->SenseCount)); | 2865 | le32_to_cpu(mpi_reply->SenseCount)); |
2866 | memcpy(scmd->sense_buffer, sense_data, sz); | ||
2868 | _scsih_normalize_sense(scmd->sense_buffer, &data); | 2867 | _scsih_normalize_sense(scmd->sense_buffer, &data); |
2869 | /* failure prediction threshold exceeded */ | 2868 | /* failure prediction threshold exceeded */ |
2870 | if (data.asc == 0x5D) | 2869 | if (data.asc == 0x5D) |
@@ -3923,7 +3922,7 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, | |||
3923 | 3922 | ||
3924 | mpt2sas_scsih_issue_tm(ioc, handle, lun, | 3923 | mpt2sas_scsih_issue_tm(ioc, handle, lun, |
3925 | MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK, smid, 30); | 3924 | MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK, smid, 30); |
3926 | termination_count += le32_to_cpu(mpi_reply->TerminationCount); | 3925 | ioc->tm_cmds.status = MPT2_CMD_NOT_USED; |
3927 | 3926 | ||
3928 | if ((mpi_reply->IOCStatus == MPI2_IOCSTATUS_SUCCESS) && | 3927 | if ((mpi_reply->IOCStatus == MPI2_IOCSTATUS_SUCCESS) && |
3929 | (mpi_reply->ResponseCode == | 3928 | (mpi_reply->ResponseCode == |
@@ -3933,10 +3932,10 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, | |||
3933 | continue; | 3932 | continue; |
3934 | 3933 | ||
3935 | mpt2sas_scsih_issue_tm(ioc, handle, lun, | 3934 | mpt2sas_scsih_issue_tm(ioc, handle, lun, |
3936 | MPI2_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET, smid, 30); | 3935 | MPI2_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET, 0, 30); |
3936 | ioc->tm_cmds.status = MPT2_CMD_NOT_USED; | ||
3937 | termination_count += le32_to_cpu(mpi_reply->TerminationCount); | 3937 | termination_count += le32_to_cpu(mpi_reply->TerminationCount); |
3938 | } | 3938 | } |
3939 | ioc->tm_cmds.status = MPT2_CMD_NOT_USED; | ||
3940 | ioc->broadcast_aen_busy = 0; | 3939 | ioc->broadcast_aen_busy = 0; |
3941 | mutex_unlock(&ioc->tm_cmds.mutex); | 3940 | mutex_unlock(&ioc->tm_cmds.mutex); |
3942 | 3941 | ||
@@ -4962,7 +4961,7 @@ static void | |||
4962 | _firmware_event_work(struct work_struct *work) | 4961 | _firmware_event_work(struct work_struct *work) |
4963 | { | 4962 | { |
4964 | struct fw_event_work *fw_event = container_of(work, | 4963 | struct fw_event_work *fw_event = container_of(work, |
4965 | struct fw_event_work, work.work); | 4964 | struct fw_event_work, work); |
4966 | unsigned long flags; | 4965 | unsigned long flags; |
4967 | struct MPT2SAS_ADAPTER *ioc = fw_event->ioc; | 4966 | struct MPT2SAS_ADAPTER *ioc = fw_event->ioc; |
4968 | 4967 | ||