Print this page
NEX-9981 Deadman timer panic from idm_refcnt_wait_ref thread while offlining iSCSI targets
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
NEX-6018 Return of the walking dead idm_refcnt_wait_ref comstar threads
Reviewed by:  Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by:  Evan Layton <evan.layton@nexenta.com>
NEX-3177 enums and string arrays required to be in sync.
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Steve Peng <steve.peng@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/idm/idm.h
          +++ new/usr/src/uts/common/sys/idm/idm.h
↓ 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  /*
  23   23   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
       24 + * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
  24   25   * Use is subject to license terms.
  25   26   */
  26   27  
  27   28  #ifndef _IDM_H
  28   29  #define _IDM_H
  29   30  
  30   31  #ifdef  __cplusplus
  31   32  extern "C" {
  32   33  #endif
  33   34  
       35 +#include <sys/stmf_defines.h>
       36 +
  34   37  typedef enum {
  35   38          IDM_STATUS_SUCCESS = 0,
  36   39          IDM_STATUS_FAIL,
  37   40          IDM_STATUS_NORESOURCES,
  38   41          IDM_STATUS_REJECT,
  39   42          IDM_STATUS_IO,
  40   43          IDM_STATUS_ABORTED,
  41   44          IDM_STATUS_SUSPENDED,
  42   45          IDM_STATUS_HEADER_DIGEST,
  43   46          IDM_STATUS_DATA_DIGEST,
  44   47          IDM_STATUS_PROTOCOL_ERROR,
  45   48          IDM_STATUS_LOGIN_FAIL
  46   49  } idm_status_t;
  47   50  
       51 +#define IDM_CLIENT_NOTIFY_LIST() \
       52 +        item(CN_UNDEFINED) \
       53 +        item(CN_CONNECT_ACCEPT)         /* Target only */ \
       54 +        item(CN_LOGIN_FAIL) \
       55 +        item(CN_READY_FOR_LOGIN)        /* Initiator only */ \
       56 +        item(CN_FFP_ENABLED) \
       57 +        item(CN_FFP_DISABLED) \
       58 +        item(CN_CONNECT_LOST) \
       59 +        item(CN_CONNECT_DESTROY) \
       60 +        item(CN_CONNECT_FAIL) \
       61 +        item(CN_MAX)
  48   62  
  49   63  typedef enum {
  50      -        CN_CONNECT_ACCEPT = 1,  /* Target only */
  51      -        CN_LOGIN_FAIL,
  52      -        CN_READY_FOR_LOGIN,     /* Initiator only */
  53      -        CN_FFP_ENABLED,
  54      -        CN_FFP_DISABLED,
  55      -        CN_CONNECT_LOST,
  56      -        CN_CONNECT_DESTROY,
  57      -        CN_CONNECT_FAIL,
  58      -        CN_MAX
       64 +#define item(a) a,
       65 +        IDM_CLIENT_NOTIFY_LIST()
       66 +#undef  item
  59   67  } idm_client_notify_t;
  60   68  
  61   69  #ifdef IDM_CN_NOTIFY_STRINGS
  62   70  static const char *idm_cn_strings[CN_MAX + 1] = {
  63      -        "CN_UNDEFINED",
  64      -        "CN_CONNECT_ACCEPT",
  65      -        "CN_LOGIN_FAIL",
  66      -        "CN_READY_FOR_LOGIN",
  67      -        "CN_FFP_ENABLED",
  68      -        "CN_FFP_DISABLED",
  69      -        "CN_CONNECT_LOST",
  70      -        "CN_CONNECT_DESTROY",
  71      -        "CN_CONNECT_FAIL",
  72      -        "CN_MAX"
       71 +#define item(a) #a,
       72 +        IDM_CLIENT_NOTIFY_LIST()
       73 +#undef  item
  73   74  };
  74   75  #endif
  75   76  
  76   77  typedef enum {
  77   78          FD_CONN_FAIL,
  78   79          FD_CONN_LOGOUT,
  79   80          FD_SESS_LOGOUT
  80   81  } idm_ffp_disable_t;
  81   82  
  82   83  typedef enum {
  83   84          AT_INTERNAL_SUSPEND,
  84   85          AT_INTERNAL_ABORT,
  85   86          AT_TASK_MGMT_ABORT
  86   87  } idm_abort_type_t;
  87   88  
       89 +#define IDM_TASK_STATE_LIST() \
       90 +        item(TASK_IDLE) \
       91 +        item(TASK_ACTIVE) \
       92 +        item(TASK_SUSPENDING) \
       93 +        item(TASK_SUSPENDED) \
       94 +        item(TASK_ABORTING) \
       95 +        item(TASK_ABORTED) \
       96 +        item(TASK_COMPLETE) \
       97 +        item(TASK_MAX_STATE)
       98 +
  88   99  typedef enum {
  89      -        TASK_IDLE,
  90      -        TASK_ACTIVE,
  91      -        TASK_SUSPENDING,
  92      -        TASK_SUSPENDED,
  93      -        TASK_ABORTING,
  94      -        TASK_ABORTED,
  95      -        TASK_COMPLETE,
  96      -        TASK_MAX_STATE
      100 +#define item(a) a,
      101 +        IDM_TASK_STATE_LIST()
      102 +#undef  item
  97  103  } idm_task_state_t;
  98  104  
  99  105  #ifdef IDM_TASK_SM_STRINGS
 100  106  static const char *idm_ts_name[TASK_MAX_STATE+1] = {
 101      -        "TASK_IDLE",
 102      -        "TASK_ACTIVE",
 103      -        "TASK_SUSPENDING",
 104      -        "TASK_SUSPENDED",
 105      -        "TASK_ABORTING",
 106      -        "TASK_ABORTED",
 107      -        "TASK_COMPLETE",
 108      -        "TASK_MAX_STATE"
      107 +#define item(a) #a,
      108 +        IDM_TASK_STATE_LIST()
      109 +#undef  item
 109  110  };
 110  111  #endif
 111  112  
 112  113  typedef enum {
 113  114          KV_HANDLED = 0,
 114  115          KV_HANDLED_NO_TRANSIT,
 115  116          KV_UNHANDLED,
 116  117          KV_TARGET_ONLY,
 117  118          KV_NO_RESOURCES,
 118  119          KV_INTERNAL_ERROR,
↓ open down ↓ 315 lines elided ↑ open up ↑
 434  435  
 435  436  /*
 436  437   * Task services
 437  438   */
 438  439  idm_task_t *
 439  440  idm_task_alloc(idm_conn_t *ic);
 440  441  
 441  442  void
 442  443  idm_task_start(idm_task_t *idt, uintptr_t handle);
 443  444  
 444      -void
      445 +stmf_status_t
 445  446  idm_task_abort(idm_conn_t *ic, idm_task_t *idt, idm_abort_type_t abort_type);
 446  447  
 447  448  void
 448  449  idm_task_cleanup(idm_task_t *idt);
 449  450  
 450  451  void
 451  452  idm_task_done(idm_task_t *idt);
 452  453  
 453  454  void
 454  455  idm_task_free(idm_task_t *idt);
↓ open down ↓ 62 lines elided ↑ open up ↑
 517  518  
 518  519  void
 519  520  idm_refcnt_rele_and_destroy(idm_refcnt_t *refcnt, idm_refcnt_cb_t *cb_func);
 520  521  
 521  522  void
 522  523  idm_refcnt_wait_ref(idm_refcnt_t *refcnt);
 523  524  
 524  525  void
 525  526  idm_refcnt_async_wait_ref(idm_refcnt_t *refcnt, idm_refcnt_cb_t *cb_func);
 526  527  
      528 +int
      529 +idm_refcnt_is_held(idm_refcnt_t *refcnt);
 527  530  
 528  531  #ifdef  __cplusplus
 529  532  }
 530  533  #endif
 531  534  
 532  535  #endif /* _IDM_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX