- /* Don't set DONE (or clear AT_INITIATOR) for any task going into the
- * error path, because the EH interprets that as a handled error condition.
- * Also don't take action if there is a reset pending.
- */
- if ((task_notification_selection != isci_perform_error_io_completion)
- && !(task->task_state_flags & SAS_TASK_NEED_DEV_RESET))
- isci_set_task_doneflags(task);
+ /* If a device reset is being indicated, make sure the I/O
+ * is in the error path.
+ */
+ if (task->task_state_flags & SAS_TASK_NEED_DEV_RESET)
+ task_notification_selection = isci_perform_error_io_completion;
+
+ switch (task_notification_selection) {
+
+ case isci_perform_aborted_io_completion:
+ /* This path can occur with task-managed requests as well as
+ * requests terminated because of LUN or device resets.
+ */
+ /* Fall through to the normal case... */
+
+ case isci_perform_normal_io_completion:
+ /* Normal notification (task_done) */
+ isci_set_task_doneflags(task);
+ break;
+
+ default:
+ WARN_ON(FALSE);
+ /* Fall through to the error case... */
+
+ case isci_perform_error_io_completion:
+ /* Use sas_task_abort */
+ /* Leave SAS_TASK_STATE_DONE clear
+ * Leave SAS_TASK_AT_INITIATOR set.
+ */
+ break;
+ }