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>
        
*** 19,28 ****
--- 19,29 ----
   * CDDL HEADER END
   */
  
  /*
   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+  * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
   * Use is subject to license terms.
   */
  
  #ifndef _IDM_H
  #define _IDM_H
*** 29,38 ****
--- 30,41 ----
  
  #ifdef  __cplusplus
  extern "C" {
  #endif
  
+ #include <sys/stmf_defines.h>
+ 
  typedef enum {
          IDM_STATUS_SUCCESS = 0,
          IDM_STATUS_FAIL,
          IDM_STATUS_NORESOURCES,
          IDM_STATUS_REJECT,
*** 43,77 ****
          IDM_STATUS_DATA_DIGEST,
          IDM_STATUS_PROTOCOL_ERROR,
          IDM_STATUS_LOGIN_FAIL
  } idm_status_t;
  
  
  typedef enum {
!         CN_CONNECT_ACCEPT = 1,  /* Target only */
!         CN_LOGIN_FAIL,
!         CN_READY_FOR_LOGIN,     /* Initiator only */
!         CN_FFP_ENABLED,
!         CN_FFP_DISABLED,
!         CN_CONNECT_LOST,
!         CN_CONNECT_DESTROY,
!         CN_CONNECT_FAIL,
!         CN_MAX
  } idm_client_notify_t;
  
  #ifdef IDM_CN_NOTIFY_STRINGS
  static const char *idm_cn_strings[CN_MAX + 1] = {
!         "CN_UNDEFINED",
!         "CN_CONNECT_ACCEPT",
!         "CN_LOGIN_FAIL",
!         "CN_READY_FOR_LOGIN",
!         "CN_FFP_ENABLED",
!         "CN_FFP_DISABLED",
!         "CN_CONNECT_LOST",
!         "CN_CONNECT_DESTROY",
!         "CN_CONNECT_FAIL",
!         "CN_MAX"
  };
  #endif
  
  typedef enum {
          FD_CONN_FAIL,
--- 46,78 ----
          IDM_STATUS_DATA_DIGEST,
          IDM_STATUS_PROTOCOL_ERROR,
          IDM_STATUS_LOGIN_FAIL
  } idm_status_t;
  
+ #define IDM_CLIENT_NOTIFY_LIST() \
+         item(CN_UNDEFINED) \
+         item(CN_CONNECT_ACCEPT)         /* Target only */ \
+         item(CN_LOGIN_FAIL) \
+         item(CN_READY_FOR_LOGIN)        /* Initiator only */ \
+         item(CN_FFP_ENABLED) \
+         item(CN_FFP_DISABLED) \
+         item(CN_CONNECT_LOST) \
+         item(CN_CONNECT_DESTROY) \
+         item(CN_CONNECT_FAIL) \
+         item(CN_MAX)
  
  typedef enum {
! #define item(a) a,
!         IDM_CLIENT_NOTIFY_LIST()
! #undef  item
  } idm_client_notify_t;
  
  #ifdef IDM_CN_NOTIFY_STRINGS
  static const char *idm_cn_strings[CN_MAX + 1] = {
! #define item(a) #a,
!         IDM_CLIENT_NOTIFY_LIST()
! #undef  item
  };
  #endif
  
  typedef enum {
          FD_CONN_FAIL,
*** 83,113 ****
          AT_INTERNAL_SUSPEND,
          AT_INTERNAL_ABORT,
          AT_TASK_MGMT_ABORT
  } idm_abort_type_t;
  
  typedef enum {
!         TASK_IDLE,
!         TASK_ACTIVE,
!         TASK_SUSPENDING,
!         TASK_SUSPENDED,
!         TASK_ABORTING,
!         TASK_ABORTED,
!         TASK_COMPLETE,
!         TASK_MAX_STATE
  } idm_task_state_t;
  
  #ifdef IDM_TASK_SM_STRINGS
  static const char *idm_ts_name[TASK_MAX_STATE+1] = {
!         "TASK_IDLE",
!         "TASK_ACTIVE",
!         "TASK_SUSPENDING",
!         "TASK_SUSPENDED",
!         "TASK_ABORTING",
!         "TASK_ABORTED",
!         "TASK_COMPLETE",
!         "TASK_MAX_STATE"
  };
  #endif
  
  typedef enum {
          KV_HANDLED = 0,
--- 84,114 ----
          AT_INTERNAL_SUSPEND,
          AT_INTERNAL_ABORT,
          AT_TASK_MGMT_ABORT
  } idm_abort_type_t;
  
+ #define IDM_TASK_STATE_LIST() \
+         item(TASK_IDLE) \
+         item(TASK_ACTIVE) \
+         item(TASK_SUSPENDING) \
+         item(TASK_SUSPENDED) \
+         item(TASK_ABORTING) \
+         item(TASK_ABORTED) \
+         item(TASK_COMPLETE) \
+         item(TASK_MAX_STATE)
+ 
  typedef enum {
! #define item(a) a,
!         IDM_TASK_STATE_LIST()
! #undef  item
  } idm_task_state_t;
  
  #ifdef IDM_TASK_SM_STRINGS
  static const char *idm_ts_name[TASK_MAX_STATE+1] = {
! #define item(a) #a,
!         IDM_TASK_STATE_LIST()
! #undef  item
  };
  #endif
  
  typedef enum {
          KV_HANDLED = 0,
*** 439,449 ****
  idm_task_alloc(idm_conn_t *ic);
  
  void
  idm_task_start(idm_task_t *idt, uintptr_t handle);
  
! void
  idm_task_abort(idm_conn_t *ic, idm_task_t *idt, idm_abort_type_t abort_type);
  
  void
  idm_task_cleanup(idm_task_t *idt);
  
--- 440,450 ----
  idm_task_alloc(idm_conn_t *ic);
  
  void
  idm_task_start(idm_task_t *idt, uintptr_t handle);
  
! stmf_status_t
  idm_task_abort(idm_conn_t *ic, idm_task_t *idt, idm_abort_type_t abort_type);
  
  void
  idm_task_cleanup(idm_task_t *idt);
  
*** 522,531 ****
--- 523,534 ----
  idm_refcnt_wait_ref(idm_refcnt_t *refcnt);
  
  void
  idm_refcnt_async_wait_ref(idm_refcnt_t *refcnt, idm_refcnt_cb_t *cb_func);
  
+ int
+ idm_refcnt_is_held(idm_refcnt_t *refcnt);
  
  #ifdef  __cplusplus
  }
  #endif