Print this page
    
SUP-770 deadlock between thread acquiring iss->iss_lockp in stmf_task_free() and thread holding sl->sl_pgr->pgr_lock from sbd_pgr_remove_it_handle()
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/uts/common/io/comstar/stmf/lun_map.h
          +++ new/usr/src/uts/common/io/comstar/stmf/lun_map.h
   1    1  /*
   2    2   * CDDL HEADER START
   3    3   *
   4    4   * The contents of this file are subject to the terms of the
   5    5   * Common Development and Distribution License (the "License").
   6    6   * You may not use this file except in compliance with the License.
   7    7   *
   8    8   * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9    9   * or http://www.opensolaris.org/os/licensing.
  10   10   * See the License for the specific language governing permissions
  11   11   * and limitations under the License.
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  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 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  #ifndef _LUN_MAP_H
  26   26  #define _LUN_MAP_H
  27   27  
  28   28  #include <sys/stmf_defines.h>
  29   29  
  30   30  #ifdef  __cplusplus
  31   31  extern "C" {
  32   32  #endif
  33   33  
  34   34  typedef struct stmf_lun_map {
  35   35          uint32_t        lm_nluns;
  36   36          uint32_t        lm_nentries;
  37   37          void            **lm_plus; /* this can be lun or view entry */
  38   38  } stmf_lun_map_t;
  39   39  
  40   40  struct stmf_itl_data;
  
    | 
      ↓ open down ↓ | 
    40 lines elided | 
    
      ↑ open up ↑ | 
  
  41   41  
  42   42  typedef struct stmf_lun_map_ent {
  43   43          struct stmf_lu          *ent_lu;
  44   44          struct stmf_itl_data    *ent_itl_datap;
  45   45  } stmf_lun_map_ent_t;
  46   46  
  47   47  void stmf_view_init();
  48   48  void stmf_view_clear_config();
  49   49  stmf_status_t stmf_session_create_lun_map(stmf_i_local_port_t *ilport,
  50   50                  stmf_i_scsi_session_t *iss);
  51      -stmf_status_t stmf_session_destroy_lun_map(stmf_i_local_port_t *ilport,
  52      -                stmf_i_scsi_session_t *iss);
  53   51  stmf_xfer_data_t *stmf_session_prepare_report_lun_data(stmf_lun_map_t *sm);
  54   52  void stmf_add_lu_to_active_sessions(stmf_lu_t *lu);
  55   53  void stmf_session_lu_unmapall(stmf_lu_t *lu);
  56   54  void *stmf_get_ent_from_map(stmf_lun_map_t *sm, uint16_t lun_num);
  57   55  
  58   56  
  59   57  /*
  60   58   * Common struct used to maintain an Identifer's data. That Identifier
  61   59   * can be a Host group, Target group or LU GUID data. Note that a LU is
  62   60   * different from LU GUID data because either can be there without
  63   61   * its counterpart being present in the system.
  64   62   * id_impl_specific pointer to:
  65   63   * case LUID, a list of stmf_view_entry
  66   64   * case initiator group, a list of initiators
  67   65   * case target group, a list of targets
  68   66   * id_pt_to_object pointer to stmf_i_lu_t instance for LU.
  69   67   */
  70   68  typedef struct stmf_id_data {
  71   69          struct stmf_id_data             *id_next;
  72   70          struct stmf_id_data             *id_prev;
  73   71          uint32_t                        id_refcnt;
  74   72          uint16_t                        id_type;
  75   73          uint16_t                        id_data_size;
  76   74          uint8_t                         *id_data;
  77   75          uint32_t                        id_total_alloc_size;
  78   76          uint32_t                        id_rsvd;
  79   77          void                            *id_pt_to_object;
  80   78          void                            *id_impl_specific;
  81   79  } stmf_id_data_t;
  82   80  
  83   81  typedef enum {
  84   82          STMF_ID_TYPE_HOST,
  85   83          STMF_ID_TYPE_TARGET,
  86   84          STMF_ID_TYPE_LU_GUID,
  87   85          STMF_ID_TYPE_HOST_GROUP,
  88   86          STMF_ID_TYPE_TARGET_GROUP
  89   87  } stmf_id_type_t;
  90   88  
  91   89  typedef struct stmf_id_list {
  92   90          stmf_id_data_t          *idl_head;
  93   91          stmf_id_data_t          *idl_tail;
  94   92          uint32_t                id_count;
  95   93  } stmf_id_list_t;
  96   94  
  97   95  typedef struct stmf_view_entry {
  98   96          struct stmf_view_entry  *ve_next;
  99   97          struct stmf_view_entry  *ve_prev;
 100   98          uint32_t                ve_id;
 101   99          stmf_id_data_t          *ve_hg;
 102  100          stmf_id_data_t          *ve_tg;
 103  101          stmf_id_data_t          *ve_luid;
 104  102          uint8_t                 ve_lun[8];
 105  103  } stmf_view_entry_t;
 106  104  
 107  105  /*
 108  106   * Following structs are used as an alternate representation of view entries
 109  107   * in a LU ID.
 110  108   * ver_tg_root--->ver_tg_t    +-> ver_tg_t ....
 111  109   *                   |        |
 112  110   *                  vert_next-+
 113  111   *                   |
 114  112   *                   vert_verh_list --> ver_hg_t  +-> ver_hg_t ....
 115  113   *                                        |       |
 116  114   *                                      verh_next-+
 117  115   *                                        |
 118  116   *                                      verh_ve_map (view entry map for this
 119  117   *                                             target group + host group )
 120  118   */
 121  119  
 122  120  typedef struct ver_hg {
 123  121          struct ver_hg           *verh_next;
 124  122          stmf_id_data_t          *verh_hg_ref;   /* ref. to the host group */
 125  123          stmf_lun_map_t          verh_ve_map;
 126  124  } stmf_ver_hg_t;
 127  125  
 128  126  typedef struct ver_tg {
 129  127          struct ver_tg           *vert_next;
 130  128          stmf_id_data_t          *vert_tg_ref;   /* ref to target group */
 131  129          stmf_ver_hg_t           *vert_verh_list;
 132  130  } stmf_ver_tg_t;
 133  131  
 134  132  /*
 135  133   * flag which define how the merging of maps is to be done.
 136  134   */
 137  135  typedef enum {
 138  136          MERGE_FLAG_NO_DUPLICATE         = 0x01, /* fail upon duplicate */
 139  137          MERGE_FLAG_RETURN_NEW_MAP       = 0x02, /* Does not modify dst */
 140  138          MERGE_FLAG_NONE                 = 0
 141  139  } stmf_merge_flags_t;
 142  140  
 143  141  int stmf_add_group_member(uint8_t *grpname, uint16_t grpname_size,
 144  142                  uint8_t *entry_ident, uint16_t entry_size,
 145  143                  stmf_id_type_t entry_type, uint32_t *err_detail);
 146  144  int stmf_remove_group_member(uint8_t *grpname, uint16_t grpname_size,
 147  145                  uint8_t *entry_ident, uint16_t entry_size,
 148  146                  stmf_id_type_t entry_type, uint32_t *err_detail);
 149  147  int stmf_remove_group(uint8_t *grpname, uint16_t grpname_size,
 150  148                  stmf_id_type_t group_type, uint32_t *err_detail);
 151  149  int stmf_add_group(uint8_t *grpname, uint16_t grpname_size,
 152  150                  stmf_id_type_t group_type, uint32_t *err_detail);
 153  151  int stmf_add_ve(uint8_t *hgname, uint16_t hgname_size, uint8_t *tgname,
 154  152                  uint16_t tgname_size, uint8_t *lu_guid, uint32_t *ve_id,
 155  153                  uint8_t *luNbr, uint32_t *err_detail);
 156  154  int stmf_validate_lun_ve(uint8_t *hgname, uint16_t hgname_size, uint8_t *tgname,
 157  155                  uint16_t tgname_size, uint8_t *luNbr, uint32_t *err_detail);
 158  156  int stmf_remove_ve_by_id(uint8_t *guid, uint32_t veid, uint32_t *err_detail);
 159  157  stmf_id_data_t *stmf_lookup_id(stmf_id_list_t *idlist, uint16_t id_size,
 160  158                  uint8_t *data);
 161  159  stmf_id_data_t *stmf_lookup_group_for_target(uint8_t *ident,
 162  160                  uint16_t ident_size);
 163  161  
 164  162  #ifdef  __cplusplus
 165  163  }
 166  164  #endif
 167  165  
 168  166  #endif /* _LUN_MAP_H */
  
    | 
      ↓ open down ↓ | 
    106 lines elided | 
    
      ↑ open up ↑ | 
  
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX