Author: mav
Date: Tue Feb 17 17:34:45 2015
New Revision: 278906
URL: https://svnweb.freebsd.org/changeset/base/278906

Log:
  MFC r278500: Do not abort already aborted tasks.
  
  This fixes abort of new tasks with the same tags as previously aborted,
  but still remaining on the queue.

Modified:
  stable/10/sys/cam/ctl/ctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl.c Tue Feb 17 16:01:00 2015        (r278905)
+++ stable/10/sys/cam/ctl/ctl.c Tue Feb 17 17:34:45 2015        (r278906)
@@ -12176,64 +12176,57 @@ ctl_abort_task(union ctl_io *io)
                printf("%s\n", sbuf_data(&sb));
 #endif
 
-               if ((xio->io_hdr.nexus.targ_port == io->io_hdr.nexus.targ_port)
-                && (xio->io_hdr.nexus.initid.id ==
-                    io->io_hdr.nexus.initid.id)) {
-                       /*
-                        * If the abort says that the task is untagged, the
-                        * task in the queue must be untagged.  Otherwise,
-                        * we just check to see whether the tag numbers
-                        * match.  This is because the QLogic firmware
-                        * doesn't pass back the tag type in an abort
-                        * request.
-                        */
+               if ((xio->io_hdr.nexus.targ_port != io->io_hdr.nexus.targ_port)
+                || (xio->io_hdr.nexus.initid.id != io->io_hdr.nexus.initid.id)
+                || (xio->io_hdr.flags & CTL_FLAG_ABORT))
+                       continue;
+
+               /*
+                * If the abort says that the task is untagged, the
+                * task in the queue must be untagged.  Otherwise,
+                * we just check to see whether the tag numbers
+                * match.  This is because the QLogic firmware
+                * doesn't pass back the tag type in an abort
+                * request.
+                */
 #if 0
-                       if (((xio->scsiio.tag_type == CTL_TAG_UNTAGGED)
-                         && (io->taskio.tag_type == CTL_TAG_UNTAGGED))
-                        || (xio->scsiio.tag_num == io->taskio.tag_num)) {
+               if (((xio->scsiio.tag_type == CTL_TAG_UNTAGGED)
+                 && (io->taskio.tag_type == CTL_TAG_UNTAGGED))
+                || (xio->scsiio.tag_num == io->taskio.tag_num)) {
 #endif
-                       /*
-                        * XXX KDM we've got problems with FC, because it
-                        * doesn't send down a tag type with aborts.  So we
-                        * can only really go by the tag number...
-                        * This may cause problems with parallel SCSI.
-                        * Need to figure that out!!
-                        */
-                       if (xio->scsiio.tag_num == io->taskio.tag_num) {
-                               xio->io_hdr.flags |= CTL_FLAG_ABORT;
-                               found = 1;
-                               if ((io->io_hdr.flags &
-                                    CTL_FLAG_FROM_OTHER_SC) == 0 &&
-                                   !(lun->flags & CTL_LUN_PRIMARY_SC)) {
-                                       union ctl_ha_msg msg_info;
-
-                                       io->io_hdr.flags |=
-                                                       CTL_FLAG_SENT_2OTHER_SC;
-                                       msg_info.hdr.nexus = io->io_hdr.nexus;
-                                       msg_info.task.task_action =
-                                               CTL_TASK_ABORT_TASK;
-                                       msg_info.task.tag_num =
-                                               io->taskio.tag_num;
-                                       msg_info.task.tag_type =
-                                               io->taskio.tag_type;
-                                       msg_info.hdr.msg_type =
-                                               CTL_MSG_MANAGE_TASKS;
-                                       msg_info.hdr.original_sc = NULL;
-                                       msg_info.hdr.serializing_sc = NULL;
+               /*
+                * XXX KDM we've got problems with FC, because it
+                * doesn't send down a tag type with aborts.  So we
+                * can only really go by the tag number...
+                * This may cause problems with parallel SCSI.
+                * Need to figure that out!!
+                */
+               if (xio->scsiio.tag_num == io->taskio.tag_num) {
+                       xio->io_hdr.flags |= CTL_FLAG_ABORT;
+                       found = 1;
+                       if ((io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) == 0 &&
+                           !(lun->flags & CTL_LUN_PRIMARY_SC)) {
+                               union ctl_ha_msg msg_info;
+
+                               io->io_hdr.flags |= CTL_FLAG_SENT_2OTHER_SC;
+                               msg_info.hdr.nexus = io->io_hdr.nexus;
+                               msg_info.task.task_action = CTL_TASK_ABORT_TASK;
+                               msg_info.task.tag_num = io->taskio.tag_num;
+                               msg_info.task.tag_type = io->taskio.tag_type;
+                               msg_info.hdr.msg_type = CTL_MSG_MANAGE_TASKS;
+                               msg_info.hdr.original_sc = NULL;
+                               msg_info.hdr.serializing_sc = NULL;
 #if 0
-                                       printf("Sent Abort to other side\n");
+                               printf("Sent Abort to other side\n");
 #endif
-                                       if (CTL_HA_STATUS_SUCCESS !=
-                                               ctl_ha_msg_send(CTL_HA_CHAN_CTL,
-                                               (void *)&msg_info,
-                                               sizeof(msg_info), 0)) {
-                                       }
+                               if (ctl_ha_msg_send(CTL_HA_CHAN_CTL,
+                                   (void *)&msg_info, sizeof(msg_info), 0) !=
+                                   CTL_HA_STATUS_SUCCESS) {
                                }
+                       }
 #if 0
-                               printf("ctl_abort_task: found I/O to abort\n");
+                       printf("ctl_abort_task: found I/O to abort\n");
 #endif
-                               break;
-                       }
                }
        }
        mtx_unlock(&lun->lun_lock);
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to