aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci
diff options
context:
space:
mode:
authorJeff Skirvin <jeffrey.d.skirvin@intel.com>2011-03-04 17:06:42 -0500
committerDan Williams <dan.j.williams@intel.com>2011-07-03 06:55:29 -0400
commita5fde225364df30507ba1a5aafeec85e595000d3 (patch)
treed86c9daaafe01e9df139fe0569d7d21ce6fa3f8d /drivers/scsi/isci
parent11b00c194cfbd0eb0d90f32c096508b2bb8be6ec (diff)
isci: fix completion / abort path.
Corrected use of the request state_lock in the completion callback. In the case where an abort (or reset) thread is trying to terminate an I/O request, it sets the request state to "aborting" (or "terminating") if the state is still "starting". One of the bugs was to never set the state to "completed". Another was to not correctly recognize the situation where the I/O had completed but the sas_task was still pending callback to task_done - this was typically a problem in the LUN and device reset cases. It is now possible that we leave isci_task_abort_task() with request->io_request_completion pointing to localy allocated aborted_io_completion struct. It may result in a system crash. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Maciej Trela <Maciej.Trela@intel.com> Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci')
-rw-r--r--drivers/scsi/isci/request.c52
-rw-r--r--drivers/scsi/isci/task.c230
2 files changed, 129 insertions, 153 deletions
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c
index 8039f1c72f72..c88e270b2b40 100644
--- a/drivers/scsi/isci/request.c
+++ b/drivers/scsi/isci/request.c
@@ -814,9 +814,8 @@ static void isci_task_save_for_upper_layer_completion(
814 break; 814 break;
815 815
816 case isci_perform_aborted_io_completion: 816 case isci_perform_aborted_io_completion:
817 /* 817 /* No notification to libsas because this request is
818 * No notification because this request is already 818 * already in the abort path.
819 * in the abort path.
820 */ 819 */
821 dev_warn(&host->pdev->dev, 820 dev_warn(&host->pdev->dev,
822 "%s: Aborted - task = %p, response=%d, status=%d\n", 821 "%s: Aborted - task = %p, response=%d, status=%d\n",
@@ -824,6 +823,19 @@ static void isci_task_save_for_upper_layer_completion(
824 task, 823 task,
825 response, 824 response,
826 status); 825 status);
826
827 /* Wake up whatever process was waiting for this
828 * request to complete.
829 */
830 WARN_ON(request->io_request_completion == NULL);
831
832 if (request->io_request_completion != NULL) {
833
834 /* Signal whoever is waiting that this
835 * request is complete.
836 */
837 complete(request->io_request_completion);
838 }
827 break; 839 break;
828 840
829 case isci_perform_error_io_completion: 841 case isci_perform_error_io_completion:
@@ -847,7 +859,7 @@ static void isci_task_save_for_upper_layer_completion(
847 response, 859 response,
848 status); 860 status);
849 861
850 /* Add to the aborted list. */ 862 /* Add to the error to libsas list. */
851 list_add(&request->completed_node, 863 list_add(&request->completed_node,
852 &host->requests_to_errorback); 864 &host->requests_to_errorback);
853 break; 865 break;
@@ -873,8 +885,6 @@ void isci_request_io_request_complete(
873 struct ssp_response_iu *resp_iu; 885 struct ssp_response_iu *resp_iu;
874 void *resp_buf; 886 void *resp_buf;
875 unsigned long task_flags; 887 unsigned long task_flags;
876 unsigned long state_flags;
877 struct completion *io_request_completion;
878 struct isci_remote_device *isci_device = request->isci_device; 888 struct isci_remote_device *isci_device = request->isci_device;
879 enum service_response response = SAS_TASK_UNDELIVERED; 889 enum service_response response = SAS_TASK_UNDELIVERED;
880 enum exec_status status = SAS_ABORTED_TASK; 890 enum exec_status status = SAS_ABORTED_TASK;
@@ -891,9 +901,8 @@ void isci_request_io_request_complete(
891 task->data_dir, 901 task->data_dir,
892 completion_status); 902 completion_status);
893 903
894 spin_lock_irqsave(&request->state_lock, state_flags); 904 spin_lock(&request->state_lock);
895 request_status = isci_request_get_state(request); 905 request_status = isci_request_get_state(request);
896 spin_unlock_irqrestore(&request->state_lock, state_flags);
897 906
898 /* Decode the request status. Note that if the request has been 907 /* Decode the request status. Note that if the request has been
899 * aborted by a task management function, we don't care 908 * aborted by a task management function, we don't care
@@ -928,6 +937,8 @@ void isci_request_io_request_complete(
928 937
929 complete_to_host = isci_perform_aborted_io_completion; 938 complete_to_host = isci_perform_aborted_io_completion;
930 /* This was an aborted request. */ 939 /* This was an aborted request. */
940
941 spin_unlock(&request->state_lock);
931 break; 942 break;
932 943
933 case aborting: 944 case aborting:
@@ -955,6 +966,8 @@ void isci_request_io_request_complete(
955 complete_to_host = isci_perform_aborted_io_completion; 966 complete_to_host = isci_perform_aborted_io_completion;
956 967
957 /* This was an aborted request. */ 968 /* This was an aborted request. */
969
970 spin_unlock(&request->state_lock);
958 break; 971 break;
959 972
960 case terminating: 973 case terminating:
@@ -977,13 +990,20 @@ void isci_request_io_request_complete(
977 else 990 else
978 status = SAS_ABORTED_TASK; 991 status = SAS_ABORTED_TASK;
979 992
980 complete_to_host = isci_perform_normal_io_completion; 993 complete_to_host = isci_perform_aborted_io_completion;
981 994
982 /* This was a terminated request. */ 995 /* This was a terminated request. */
996
997 spin_unlock(&request->state_lock);
983 break; 998 break;
984 999
985 default: 1000 default:
986 1001
1002 /* The request is done from an SCU HW perspective. */
1003 request->status = completed;
1004
1005 spin_unlock(&request->state_lock);
1006
987 /* This is an active request being completed from the core. */ 1007 /* This is an active request being completed from the core. */
988 switch (completion_status) { 1008 switch (completion_status) {
989 1009
@@ -1185,20 +1205,6 @@ void isci_request_io_request_complete(
1185 */ 1205 */
1186 request->sci_request_handle = NULL; 1206 request->sci_request_handle = NULL;
1187 1207
1188 /* Save possible completion ptr. */
1189 io_request_completion = request->io_request_completion;
1190
1191 if (io_request_completion) {
1192
1193 /* This is inherantly a regular I/O request,
1194 * since we are currently in the regular
1195 * I/O completion callback function.
1196 * Signal whoever is waiting that this
1197 * request is complete.
1198 */
1199 complete(io_request_completion);
1200 }
1201
1202 isci_host_can_dequeue(isci_host, 1); 1208 isci_host_can_dequeue(isci_host, 1);
1203} 1209}
1204 1210
diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c
index 779f6cfba6be..02c40c00cb8b 100644
--- a/drivers/scsi/isci/task.c
+++ b/drivers/scsi/isci/task.c
@@ -618,9 +618,6 @@ static enum isci_request_status isci_task_validate_request_to_abort(
618 old_state = isci_request_change_started_to_aborted( 618 old_state = isci_request_change_started_to_aborted(
619 isci_request, aborted_io_completion); 619 isci_request, aborted_io_completion);
620 620
621 /* Only abort requests in the started state. */
622 if (old_state != started)
623 old_state = unallocated;
624 } 621 }
625 622
626 return old_state; 623 return old_state;
@@ -644,10 +641,23 @@ static void isci_request_cleanup_completed_loiterer(
644 641
645 spin_lock_irqsave(&isci_host->scic_lock, flags); 642 spin_lock_irqsave(&isci_host->scic_lock, flags);
646 list_del_init(&isci_request->dev_node); 643 list_del_init(&isci_request->dev_node);
647 if (task != NULL)
648 task->lldd_task = NULL;
649 spin_unlock_irqrestore(&isci_host->scic_lock, flags); 644 spin_unlock_irqrestore(&isci_host->scic_lock, flags);
650 645
646 if (task != NULL) {
647
648 spin_lock_irqsave(&task->task_state_lock, flags);
649 task->lldd_task = NULL;
650
651 isci_set_task_doneflags(task);
652
653 /* If this task is not in the abort path, call task_done. */
654 if (!(task->task_state_flags & SAS_TASK_STATE_ABORTED)) {
655
656 spin_unlock_irqrestore(&task->task_state_lock, flags);
657 task->task_done(task);
658 } else
659 spin_unlock_irqrestore(&task->task_state_lock, flags);
660 }
651 isci_request_free(isci_host, isci_request); 661 isci_request_free(isci_host, isci_request);
652} 662}
653/** 663/**
@@ -684,17 +694,20 @@ static void isci_terminate_request_core(
684 spin_lock_irqsave(&isci_request->state_lock, flags); 694 spin_lock_irqsave(&isci_request->state_lock, flags);
685 request_status = isci_request_get_state(isci_request); 695 request_status = isci_request_get_state(isci_request);
686 696
687 /* TMFs are in their own thread */ 697 if ((isci_request->ttype == io_task) /* TMFs are in their own thread */
688 if ((isci_request->ttype == io_task) && 698 && ((request_status == aborted)
689 ((request_status == aborted) || 699 || (request_status == aborting)
690 (request_status == aborting) || 700 || (request_status == terminating)
691 (request_status == terminating))) 701 || (request_status == completed)
702 )
703 ) {
704
692 /* The completion routine won't free a request in 705 /* The completion routine won't free a request in
693 * the aborted/aborting/terminating state, so we do 706 * the aborted/aborting/terminating state, so we do
694 * it here. 707 * it here.
695 */ 708 */
696 needs_cleanup_handling = true; 709 needs_cleanup_handling = true;
697 710 }
698 spin_unlock_irqrestore(&isci_request->state_lock, flags); 711 spin_unlock_irqrestore(&isci_request->state_lock, flags);
699 712
700 spin_lock_irqsave(&isci_host->scic_lock, flags); 713 spin_lock_irqsave(&isci_host->scic_lock, flags);
@@ -765,10 +778,10 @@ static void isci_terminate_request(
765 new_request_state 778 new_request_state
766 ); 779 );
767 780
768 spin_unlock_irqrestore(&isci_host->scic_lock, flags); 781 if ((old_state == started) || (old_state == completed)) {
769 782
770 if (old_state == started) 783 /* If the old_state is started:
771 /* This request was not already being aborted. If it had been, 784 * This request was not already being aborted. If it had been,
772 * then the aborting I/O (ie. the TMF request) would not be in 785 * then the aborting I/O (ie. the TMF request) would not be in
773 * the aborting state, and thus would be terminated here. Note 786 * the aborting state, and thus would be terminated here. Note
774 * that since the TMF completion's call to the kernel function 787 * that since the TMF completion's call to the kernel function
@@ -777,9 +790,15 @@ static void isci_terminate_request(
777 * special wait here for already aborting requests - the 790 * special wait here for already aborting requests - the
778 * termination of the TMF request will force the request 791 * termination of the TMF request will force the request
779 * to finish it's already started terminate. 792 * to finish it's already started terminate.
793 *
794 * If old_state == completed:
795 * This request completed from the SCU hardware perspective
796 * and now just needs cleaning up in terms of freeing the
797 * request and potentially calling up to libsas.
780 */ 798 */
781 isci_terminate_request_core(isci_host, isci_device, 799 isci_terminate_request_core(isci_host, isci_device,
782 isci_request, &request_completion); 800 isci_request, &request_completion);
801 }
783} 802}
784 803
785/** 804/**
@@ -863,10 +882,6 @@ void isci_terminate_pending_requests(
863 isci_terminate_request(isci_host, isci_device, 882 isci_terminate_request(isci_host, isci_device,
864 isci_request, new_request_state 883 isci_request, new_request_state
865 ); 884 );
866
867 /* Set the 'done' state on the task. */
868 if (task)
869 isci_task_all_done(task);
870 } 885 }
871 } while (!done); 886 } while (!done);
872} 887}
@@ -1067,13 +1082,15 @@ static void isci_abort_task_process_cb(
1067int isci_task_abort_task(struct sas_task *task) 1082int isci_task_abort_task(struct sas_task *task)
1068{ 1083{
1069 DECLARE_COMPLETION_ONSTACK(aborted_io_completion); 1084 DECLARE_COMPLETION_ONSTACK(aborted_io_completion);
1070 struct isci_request *old_request = NULL; 1085 struct isci_request *old_request = NULL;
1086 enum isci_request_status old_state;
1071 struct isci_remote_device *isci_device = NULL; 1087 struct isci_remote_device *isci_device = NULL;
1072 struct isci_host *isci_host = NULL; 1088 struct isci_host *isci_host = NULL;
1073 struct isci_tmf tmf; 1089 struct isci_tmf tmf;
1074 int ret = TMF_RESP_FUNC_FAILED; 1090 int ret = TMF_RESP_FUNC_FAILED;
1075 unsigned long flags; 1091 unsigned long flags;
1076 bool any_dev_reset, device_stopping; 1092 bool any_dev_reset = false;
1093 bool device_stopping;
1077 1094
1078 /* Get the isci_request reference from the task. Note that 1095 /* Get the isci_request reference from the task. Note that
1079 * this check does not depend on the pending request list 1096 * this check does not depend on the pending request list
@@ -1093,21 +1110,6 @@ int isci_task_abort_task(struct sas_task *task)
1093 device_stopping = (isci_device->status == isci_stopping) 1110 device_stopping = (isci_device->status == isci_stopping)
1094 || (isci_device->status == isci_stopped); 1111 || (isci_device->status == isci_stopped);
1095 1112
1096#ifdef NOMORE
1097 /* This abort task function is the first stop of the libsas error
1098 * handler thread. Since libsas is executing in a thread with a
1099 * referernce to the "task" parameter, that task cannot be completed
1100 * directly back to the upper layers. In order to make sure that
1101 * the task is managed correctly if this abort task fails, set the
1102 * "SAS_TASK_STATE_ABORTED" bit now such that completions up the
1103 * stack will be intercepted and only allowed to happen in the
1104 * libsas SCSI error handler thread.
1105 */
1106 spin_lock_irqsave(&task->task_state_lock, flags);
1107 task->task_state_flags |= SAS_TASK_STATE_ABORTED;
1108 spin_unlock_irqrestore(&task->task_state_lock, flags);
1109#endif /* NOMORE */
1110
1111 /* This version of the driver will fail abort requests for 1113 /* This version of the driver will fail abort requests for
1112 * SATA/STP. Failing the abort request this way will cause the 1114 * SATA/STP. Failing the abort request this way will cause the
1113 * SCSI error handler thread to escalate to LUN reset 1115 * SCSI error handler thread to escalate to LUN reset
@@ -1123,35 +1125,27 @@ int isci_task_abort_task(struct sas_task *task)
1123 dev_dbg(&isci_host->pdev->dev, 1125 dev_dbg(&isci_host->pdev->dev,
1124 "%s: old_request == %p\n", __func__, old_request); 1126 "%s: old_request == %p\n", __func__, old_request);
1125 1127
1128 if (!device_stopping)
1129 any_dev_reset = isci_device_is_reset_pending(isci_host,isci_device);
1130
1126 spin_lock_irqsave(&task->task_state_lock, flags); 1131 spin_lock_irqsave(&task->task_state_lock, flags);
1127 1132
1128 /* Don't do resets to stopping devices. */ 1133 /* Don't do resets to stopping devices. */
1129 if (device_stopping) 1134 if (device_stopping) {
1130 task->task_state_flags &= ~SAS_TASK_NEED_DEV_RESET;
1131 1135
1132 /* See if there is a pending device reset for this device. */ 1136 task->task_state_flags &= ~SAS_TASK_NEED_DEV_RESET;
1133 any_dev_reset = task->task_state_flags & SAS_TASK_NEED_DEV_RESET; 1137 any_dev_reset = false;
1134
1135 spin_unlock_irqrestore(&task->task_state_lock, flags);
1136 1138
1137 if ((isci_device != NULL) && !device_stopping) 1139 } else /* See if there is a pending device reset for this device. */
1138 any_dev_reset = any_dev_reset 1140 any_dev_reset = any_dev_reset
1139 || isci_device_is_reset_pending(isci_host, 1141 || (task->task_state_flags & SAS_TASK_NEED_DEV_RESET);
1140 isci_device
1141 );
1142 1142
1143 /* If the extraction of the request reference from the task 1143 /* If the extraction of the request reference from the task
1144 * failed, then the request has been completed (or if there is a 1144 * failed, then the request has been completed (or if there is a
1145 * pending reset then this abort request function must be failed 1145 * pending reset then this abort request function must be failed
1146 * in order to escalate to the target reset). 1146 * in order to escalate to the target reset).
1147 */ 1147 */
1148 if ((old_request == NULL) || 1148 if ((old_request == NULL) || any_dev_reset) {
1149 ((old_request != NULL) &&
1150 (old_request->sci_request_handle == NULL) &&
1151 (old_request->complete_in_target)) ||
1152 any_dev_reset) {
1153
1154 spin_lock_irqsave(&task->task_state_lock, flags);
1155 1149
1156 /* If the device reset task flag is set, fail the task 1150 /* If the device reset task flag is set, fail the task
1157 * management request. Otherwise, the original request 1151 * management request. Otherwise, the original request
@@ -1164,6 +1158,11 @@ int isci_task_abort_task(struct sas_task *task)
1164 */ 1158 */
1165 task->task_state_flags &= ~SAS_TASK_STATE_DONE; 1159 task->task_state_flags &= ~SAS_TASK_STATE_DONE;
1166 1160
1161 /* Make the reset happen as soon as possible. */
1162 task->task_state_flags |= SAS_TASK_NEED_DEV_RESET;
1163
1164 spin_unlock_irqrestore(&task->task_state_lock, flags);
1165
1167 /* Fail the task management request in order to 1166 /* Fail the task management request in order to
1168 * escalate to the target reset. 1167 * escalate to the target reset.
1169 */ 1168 */
@@ -1176,13 +1175,8 @@ int isci_task_abort_task(struct sas_task *task)
1176 "task %p on dev %p\n", 1175 "task %p on dev %p\n",
1177 __func__, task, isci_device); 1176 __func__, task, isci_device);
1178 1177
1179 } else {
1180 ret = TMF_RESP_FUNC_COMPLETE;
1181
1182 dev_dbg(&isci_host->pdev->dev,
1183 "%s: abort task not needed for %p\n",
1184 __func__, task);
1185 1178
1179 } else {
1186 /* The request has already completed and there 1180 /* The request has already completed and there
1187 * is nothing to do here other than to set the task 1181 * is nothing to do here other than to set the task
1188 * done bit, and indicate that the task abort function 1182 * done bit, and indicate that the task abort function
@@ -1190,89 +1184,65 @@ int isci_task_abort_task(struct sas_task *task)
1190 */ 1184 */
1191 isci_set_task_doneflags(task); 1185 isci_set_task_doneflags(task);
1192 1186
1193 /* Set the abort bit to make sure that libsas sticks the 1187 spin_unlock_irqrestore(&task->task_state_lock, flags);
1194 * task in the completed task queue.
1195 */
1196/* task->task_state_flags |= SAS_TASK_STATE_ABORTED; */
1197 1188
1198 /* Check for the situation where the request was 1189 ret = TMF_RESP_FUNC_COMPLETE;
1199 * left around on the device list but the
1200 * request already completed.
1201 */
1202 if (old_request && !old_request->sci_request_handle) {
1203 1190
1204 isci_request_cleanup_completed_loiterer( 1191 dev_dbg(&isci_host->pdev->dev,
1205 isci_host, isci_device, old_request 1192 "%s: abort task not needed for %p\n",
1206 ); 1193 __func__, task);
1207 }
1208 } 1194 }
1209 spin_unlock_irqrestore(&task->task_state_lock, flags);
1210 1195
1211 return ret; 1196 return ret;
1212 } 1197 }
1198 else
1199 spin_unlock_irqrestore(&task->task_state_lock, flags);
1213 1200
1214 spin_lock_irqsave(&isci_host->scic_lock, flags); 1201 spin_lock_irqsave(&isci_host->scic_lock, flags);
1215 1202
1216 /* Sanity check the request status, and set the I/O kernel completion 1203 /* Check the request status and change to "aborting" if currently
1204 * "starting"; if true then set the I/O kernel completion
1217 * struct that will be triggered when the request completes. 1205 * struct that will be triggered when the request completes.
1218 */ 1206 */
1219 if (isci_task_validate_request_to_abort( 1207 old_state = isci_task_validate_request_to_abort(
1220 old_request, 1208 old_request, isci_host, isci_device,
1221 isci_host, 1209 &aborted_io_completion);
1222 isci_device, 1210 if ((old_state != started) && (old_state != completed)) {
1223 &aborted_io_completion)
1224 == unallocated) {
1225 dev_dbg(&isci_host->pdev->dev,
1226 "%s: old_request not valid for device = %p\n",
1227 __func__,
1228 isci_device);
1229 old_request = NULL;
1230 }
1231
1232 if (!old_request) {
1233
1234 /* There is no isci_request attached to the sas_task.
1235 * It must have been completed and detached.
1236 */
1237 dev_dbg(&isci_host->pdev->dev,
1238 "%s: old_request == NULL\n",
1239 __func__);
1240 1211
1241 spin_unlock_irqrestore(&isci_host->scic_lock, flags); 1212 spin_unlock_irqrestore(&isci_host->scic_lock, flags);
1242 1213
1243 /* Set the state on the task. */ 1214 /* The request was already being handled by someone else (because
1244 isci_task_all_done(task); 1215 * they got to set the state away from started).
1216 */
1217 dev_dbg(&isci_host->pdev->dev,
1218 "%s: device = %p; old_request %p already being aborted\n",
1219 __func__,
1220 isci_device, old_request);
1245 1221
1246 return TMF_RESP_FUNC_COMPLETE; 1222 return TMF_RESP_FUNC_COMPLETE;
1247 } 1223 }
1248 if (task->task_proto == SAS_PROTOCOL_SMP || device_stopping) { 1224 if ((task->task_proto == SAS_PROTOCOL_SMP)
1249 1225 || device_stopping
1250 if (device_stopping) 1226 || old_request->complete_in_target
1251 dev_dbg(&isci_host->pdev->dev, 1227 ) {
1252 "%s: device is stopping, thus no TMF\n",
1253 __func__);
1254 else
1255 dev_dbg(&isci_host->pdev->dev,
1256 "%s: request is SMP, thus no TMF\n",
1257 __func__);
1258
1259 old_request->complete_in_target = true;
1260 1228
1261 spin_unlock_irqrestore(&isci_host->scic_lock, flags); 1229 spin_unlock_irqrestore(&isci_host->scic_lock, flags);
1262 1230
1231 dev_dbg(&isci_host->pdev->dev,
1232 "%s: SMP request (%d)"
1233 " or device is stopping (%d)"
1234 " or complete_in_target (%d), thus no TMF\n",
1235 __func__, (task->task_proto == SAS_PROTOCOL_SMP),
1236 device_stopping, old_request->complete_in_target);
1237
1263 /* Set the state on the task. */ 1238 /* Set the state on the task. */
1264 isci_task_all_done(task); 1239 isci_task_all_done(task);
1265 1240
1266 ret = TMF_RESP_FUNC_COMPLETE; 1241 ret = TMF_RESP_FUNC_COMPLETE;
1267 1242
1268 /* Stopping and SMP devices are not sent a TMF, and are not 1243 /* Stopping and SMP devices are not sent a TMF, and are not
1269 * reset, but the outstanding I/O request is terminated here. 1244 * reset, but the outstanding I/O request is terminated below.
1270 *
1271 * Clean up the request on our side, and wait for the aborted
1272 * I/O to complete.
1273 */ 1245 */
1274 isci_terminate_request_core(isci_host, isci_device, old_request,
1275 &aborted_io_completion);
1276 } else { 1246 } else {
1277 /* Fill in the tmf stucture */ 1247 /* Fill in the tmf stucture */
1278 isci_task_build_tmf(&tmf, isci_device, isci_tmf_ssp_task_abort, 1248 isci_task_build_tmf(&tmf, isci_device, isci_tmf_ssp_task_abort,
@@ -1288,23 +1258,23 @@ int isci_task_abort_task(struct sas_task *task)
1288 ret = isci_task_execute_tmf(isci_host, &tmf, 1258 ret = isci_task_execute_tmf(isci_host, &tmf,
1289 ISCI_ABORT_TASK_TIMEOUT_MS); 1259 ISCI_ABORT_TASK_TIMEOUT_MS);
1290 1260
1291 if (ret == TMF_RESP_FUNC_COMPLETE) { 1261 if (ret != TMF_RESP_FUNC_COMPLETE)
1292 old_request->complete_in_target = true;
1293
1294 /* Clean up the request on our side, and wait for the aborted I/O to
1295 * complete.
1296 */
1297 isci_terminate_request_core(isci_host, isci_device, old_request,
1298 &aborted_io_completion);
1299
1300 /* Set the state on the task. */
1301 isci_task_all_done(task);
1302 } else
1303 dev_err(&isci_host->pdev->dev, 1262 dev_err(&isci_host->pdev->dev,
1304 "%s: isci_task_send_tmf failed\n", 1263 "%s: isci_task_send_tmf failed\n",
1305 __func__); 1264 __func__);
1306 } 1265 }
1266 if (ret == TMF_RESP_FUNC_COMPLETE) {
1267 old_request->complete_in_target = true;
1268
1269 /* Clean up the request on our side, and wait for the aborted I/O to
1270 * complete.
1271 */
1272 isci_terminate_request_core(isci_host, isci_device, old_request,
1273 &aborted_io_completion);
1274 }
1307 1275
1276 /* Make sure we do not leave a reference to aborted_io_completion */
1277 old_request->io_request_completion = NULL;
1308 return ret; 1278 return ret;
1309} 1279}
1310 1280