Print this page
6740 ISCSI_OP_SCSI_RSP needs support
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/comstar/port/iscsit/iscsit.c
          +++ new/usr/src/uts/common/io/comstar/port/iscsit/iscsit.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   *
  24      - * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
       24 + * Copyright 2014, 2015 Nexenta Systems, Inc. All rights reserved.
  25   25   */
  26   26  
  27   27  #include <sys/cpuvar.h>
  28   28  #include <sys/types.h>
  29   29  #include <sys/conf.h>
  30   30  #include <sys/stat.h>
  31   31  #include <sys/file.h>
  32   32  #include <sys/ddi.h>
  33   33  #include <sys/sunddi.h>
  34   34  #include <sys/modctl.h>
↓ open down ↓ 902 lines elided ↑ open up ↑
 937  937          }
 938  938  }
 939  939  
 940  940  /*ARGSUSED*/
 941  941  void
 942  942  iscsit_rx_pdu_error(idm_conn_t *ic, idm_pdu_t *rx_pdu, idm_status_t status)
 943  943  {
 944  944          idm_pdu_complete(rx_pdu, IDM_STATUS_SUCCESS);
 945  945  }
 946  946  
      947 +/*
      948 + * iscsit_rx_scsi_rsp -- cause the connection to be closed if response rx'd
      949 + *
      950 + * A target sends an SCSI Response PDU, it should never receive one.
      951 + * This has been seen when running the Codemonicon suite of tests which
      952 + * does negative testing of the protocol. If such a condition occurs using
      953 + * a normal initiator it most likely means there's data corruption in the
      954 + * header and that's grounds for dropping the connection as well.
      955 + */
 947  956  void
      957 +iscsit_rx_scsi_rsp(idm_conn_t *ic, idm_pdu_t *rx_pdu)
      958 +{
      959 +        idm_pdu_complete(rx_pdu, IDM_STATUS_SUCCESS);
      960 +        idm_conn_event(ic, CE_TRANSPORT_FAIL, NULL);
      961 +}
      962 +
      963 +void
 948  964  iscsit_task_aborted(idm_task_t *idt, idm_status_t status)
 949  965  {
 950  966          iscsit_task_t *itask = idt->idt_private;
 951  967  
 952  968          switch (status) {
 953  969          case IDM_STATUS_SUSPENDED:
 954  970                  break;
 955  971          case IDM_STATUS_ABORTED:
 956  972                  mutex_enter(&itask->it_mutex);
 957  973                  itask->it_aborted = B_TRUE;
↓ open down ↓ 1426 lines elided ↑ open up ↑
2384 2400                           * Task was not found. But the SCSI command could be
2385 2401                           * on the rxpdu wait queue. If RefCmdSN is within
2386 2402                           * the CmdSN window and less than CmdSN of the TM
2387 2403                           * function, return "Function Complete". Otherwise,
2388 2404                           * return "Task Does Not Exist".
2389 2405                           */
2390 2406  
2391 2407                          if (iscsit_cmdsn_in_window(ict, refcmdsn) &&
2392 2408                              iscsit_sna_lt(refcmdsn, cmdsn)) {
2393 2409                                  mutex_enter(&ict->ict_sess->ist_sn_mutex);
2394      -                                (void) iscsit_remove_pdu_from_queue(
2395      -                                    ict->ict_sess, refcmdsn);
2396      -                                iscsit_conn_dispatch_rele(ict);
     2410 +                                if (iscsit_remove_pdu_from_queue(
     2411 +                                    ict->ict_sess, refcmdsn)) {
     2412 +                                        iscsit_conn_dispatch_rele(ict);
     2413 +                                }
2397 2414                                  mutex_exit(&ict->ict_sess->ist_sn_mutex);
2398 2415                                  iscsit_send_task_mgmt_resp(tm_resp_pdu,
2399 2416                                      SCSI_TCP_TM_RESP_COMPLETE);
2400 2417                          } else {
2401 2418                                  iscsit_send_task_mgmt_resp(tm_resp_pdu,
2402 2419                                      SCSI_TCP_TM_RESP_NO_TASK);
2403 2420                          }
2404 2421                  } else {
2405 2422  
2406 2423                          /*
↓ open down ↓ 1024 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX