Print this page
NEX-3414 CLONE - Port 3339 iscsi/fs:5 causes panic on initiator
NEX-3419 CLONE - Run multi initiator sessions to a single target test can panic the initiator
Reviewed by: Steve Peng <steve.peng@nexenta.com>


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2000 by Cisco Systems, Inc.  All rights reserved.
  23  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
  25  *
  26  * iSCSI Pseudo HBA Driver
  27  */
  28 
  29 #include <sys/socket.h>           /* networking stuff */
  30 #include <sys/t_kuser.h>  /* networking stuff */
  31 #include <sys/tihdr.h>            /* networking stuff */
  32 #include <sys/strsubr.h>  /* networking stuff */
  33 #include <netinet/tcp.h>  /* TCP_NODELAY */
  34 #include <sys/socketvar.h>        /* _ALLOC_SLEEP */
  35 #include <sys/strsun.h>           /* DB_TYPE() */
  36 #include <sys/scsi/generic/sense.h>
  37 
  38 #include "iscsi.h"              /* iscsi driver */
  39 #include <sys/iscsi_protocol.h>   /* iscsi protocol */
  40 
  41 #define ISCSI_INI_TASK_TTT      0xffffffff
  42 #define ISCSI_CONN_TIEMOUT_DETECT       20
  43 
  44 boolean_t iscsi_io_logging = B_FALSE;


3493                                  * we can flush it now.
3494                                  */
3495                                 iscsi_cmd_state_machine(icmdp,
3496                                     ISCSI_CMD_EVENT_E7, isp);
3497                         } else if (icmdp->cmd_state == ISCSI_CMD_STATE_ACTIVE) {
3498                                 /* timeout */
3499                                 iscsi_cmd_state_machine(icmdp,
3500                                     ISCSI_CMD_EVENT_E6, isp);
3501                         }
3502 
3503                 }
3504                 mutex_exit(&icp->conn_queue_active.mutex);
3505                 mutex_exit(&isp->sess_queue_pending.mutex);
3506                 mutex_exit(&icp->conn_state_mutex);
3507 
3508                 icp = icp->conn_next;
3509         }
3510 
3511         icp = isp->sess_conn_list;
3512         while (icp != NULL) {
3513                 if (icp->conn_timeout == B_TRUE) {


3514                         /* timeout on this connect detected */
3515                         idm_ini_conn_disconnect(icp->conn_ic);
3516                         icp->conn_timeout = B_FALSE;
3517                 }

3518                 icp = icp->conn_next;
3519         }
3520         rw_exit(&isp->sess_conn_list_rwlock);
3521 }
3522 
3523 /*
3524  * iscsi_nop_checks - sends a NOP on idle connections
3525  *
3526  * This function walks the connections on a session and
3527  * issues NOPs on those connections that are in FULL
3528  * FEATURE mode and have not received data for the
3529  * time period specified by iscsi_nop_delay (global).
3530  */
3531 static void
3532 iscsi_nop_checks(iscsi_sess_t *isp)
3533 {
3534         iscsi_conn_t    *icp;
3535 
3536         ASSERT(isp != NULL);
3537 




   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2000 by Cisco Systems, Inc.  All rights reserved.
  23  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2011, 2015 Nexenta Systems, Inc. All rights reserved.
  25  *
  26  * iSCSI Pseudo HBA Driver
  27  */
  28 
  29 #include <sys/socket.h>           /* networking stuff */
  30 #include <sys/t_kuser.h>  /* networking stuff */
  31 #include <sys/tihdr.h>            /* networking stuff */
  32 #include <sys/strsubr.h>  /* networking stuff */
  33 #include <netinet/tcp.h>  /* TCP_NODELAY */
  34 #include <sys/socketvar.h>        /* _ALLOC_SLEEP */
  35 #include <sys/strsun.h>           /* DB_TYPE() */
  36 #include <sys/scsi/generic/sense.h>
  37 
  38 #include "iscsi.h"              /* iscsi driver */
  39 #include <sys/iscsi_protocol.h>   /* iscsi protocol */
  40 
  41 #define ISCSI_INI_TASK_TTT      0xffffffff
  42 #define ISCSI_CONN_TIEMOUT_DETECT       20
  43 
  44 boolean_t iscsi_io_logging = B_FALSE;


3493                                  * we can flush it now.
3494                                  */
3495                                 iscsi_cmd_state_machine(icmdp,
3496                                     ISCSI_CMD_EVENT_E7, isp);
3497                         } else if (icmdp->cmd_state == ISCSI_CMD_STATE_ACTIVE) {
3498                                 /* timeout */
3499                                 iscsi_cmd_state_machine(icmdp,
3500                                     ISCSI_CMD_EVENT_E6, isp);
3501                         }
3502 
3503                 }
3504                 mutex_exit(&icp->conn_queue_active.mutex);
3505                 mutex_exit(&isp->sess_queue_pending.mutex);
3506                 mutex_exit(&icp->conn_state_mutex);
3507 
3508                 icp = icp->conn_next;
3509         }
3510 
3511         icp = isp->sess_conn_list;
3512         while (icp != NULL) {
3513                 mutex_enter(&icp->conn_state_mutex);
3514                 if ((icp->conn_timeout == B_TRUE) &&
3515                     (icp->conn_state_idm_connected == B_TRUE)) {
3516                         /* timeout on this connect detected */
3517                         idm_ini_conn_disconnect(icp->conn_ic);
3518                         icp->conn_timeout = B_FALSE;
3519                 }
3520                 mutex_exit(&icp->conn_state_mutex);
3521                 icp = icp->conn_next;
3522         }
3523         rw_exit(&isp->sess_conn_list_rwlock);
3524 }
3525 
3526 /*
3527  * iscsi_nop_checks - sends a NOP on idle connections
3528  *
3529  * This function walks the connections on a session and
3530  * issues NOPs on those connections that are in FULL
3531  * FEATURE mode and have not received data for the
3532  * time period specified by iscsi_nop_delay (global).
3533  */
3534 static void
3535 iscsi_nop_checks(iscsi_sess_t *isp)
3536 {
3537         iscsi_conn_t    *icp;
3538 
3539         ASSERT(isp != NULL);
3540