Print this page
OS-3342+co
OS-375 i_dls_mgmt_upcall()/dlmgmt_zfop() deadlock in dlmgmtd
OS-375-1


   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 /*
  23  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.

  24  */
  25 
  26 /*
  27  * Functions to maintain a table of datalink configuration information.
  28  */
  29 
  30 #ifndef _DLMGMT_IMPL_H
  31 #define _DLMGMT_IMPL_H
  32 
  33 #ifdef  __cplusplus
  34 extern "C" {
  35 #endif
  36 
  37 #include <door.h>
  38 #include <libdllink.h>
  39 #include <sys/avl.h>
  40 
  41 /*
  42  * datalink attribute structure
  43  */


  50         uint_t                          lp_sz;
  51         boolean_t                       lp_linkprop;
  52 } dlmgmt_linkattr_t;
  53 
  54 /*
  55  * datalink structure
  56  */
  57 typedef struct dlmgmt_link_s {
  58         dlmgmt_linkattr_t       *ll_head;
  59         char                    ll_link[MAXLINKNAMELEN];
  60         datalink_class_t        ll_class;
  61         uint32_t                ll_media;
  62         datalink_id_t           ll_linkid;
  63         zoneid_t                ll_zoneid;
  64         boolean_t               ll_onloan;
  65         avl_node_t              ll_name_node;
  66         avl_node_t              ll_id_node;
  67         avl_node_t              ll_loan_node;
  68         uint32_t                ll_flags;
  69         uint32_t                ll_gen;         /* generation number */

  70 } dlmgmt_link_t;
  71 
  72 /*
  73  * datalink configuration request structure
  74  */
  75 typedef struct dlmgmt_dlconf_s {
  76         dlmgmt_linkattr_t       *ld_head;
  77         char                    ld_link[MAXLINKNAMELEN];
  78         datalink_id_t           ld_linkid;
  79         datalink_class_t        ld_class;
  80         uint32_t                ld_media;
  81         int                     ld_id;
  82         zoneid_t                ld_zoneid;
  83         uint32_t                ld_gen;
  84         avl_node_t              ld_node;
  85 } dlmgmt_dlconf_t;
  86 


  87 extern boolean_t        debug;
  88 extern const char       *progname;
  89 extern char             cachefile[];
  90 extern dladm_handle_t   dld_handle;
  91 extern datalink_id_t    dlmgmt_nextlinkid;
  92 extern avl_tree_t       dlmgmt_name_avl;
  93 extern avl_tree_t       dlmgmt_id_avl;
  94 extern avl_tree_t       dlmgmt_loan_avl;
  95 extern avl_tree_t       dlmgmt_dlconf_avl;
  96 
  97 boolean_t       linkattr_equal(dlmgmt_linkattr_t **, const char *, void *,
  98                     size_t);
  99 dlmgmt_linkattr_t *linkattr_find(dlmgmt_linkattr_t *, const char *);
 100 void            linkattr_unset(dlmgmt_linkattr_t **, const char *);
 101 int             linkattr_set(dlmgmt_linkattr_t **, const char *, void *,
 102                     size_t, dladm_datatype_t);
 103 int             linkattr_get(dlmgmt_linkattr_t **, const char *, void **,
 104                     size_t *, dladm_datatype_t *);
 105 void            linkattr_destroy(dlmgmt_link_t *);
 106 


 121 
 122 int             dlconf_create(const char *, datalink_id_t, datalink_class_t,
 123                     uint32_t, zoneid_t, dlmgmt_dlconf_t **);
 124 void            dlconf_destroy(dlmgmt_dlconf_t *);
 125 void            dlmgmt_advance_dlconfid(dlmgmt_dlconf_t *);
 126 void            dlmgmt_dlconf_table_lock(boolean_t);
 127 void            dlmgmt_dlconf_table_unlock(void);
 128 
 129 int             dlmgmt_generate_name(const char *, char *, size_t, zoneid_t);
 130 
 131 void            dlmgmt_linktable_init(void);
 132 void            dlmgmt_linktable_fini(void);
 133 
 134 int             dlmgmt_zone_init(zoneid_t);
 135 int             dlmgmt_elevate_privileges(void);
 136 int             dlmgmt_drop_privileges();
 137 void            dlmgmt_handler(void *, char *, size_t, door_desc_t *, uint_t);
 138 void            dlmgmt_log(int, const char *, ...);
 139 int             dlmgmt_write_db_entry(const char *, dlmgmt_link_t *, uint32_t);
 140 int             dlmgmt_delete_db_entry(dlmgmt_link_t *, uint32_t);
 141 int             dlmgmt_db_init(zoneid_t);
 142 void            dlmgmt_db_fini(zoneid_t);
 143 
 144 #ifdef  __cplusplus
 145 }
 146 #endif
 147 
 148 #endif  /* _DLMGMT_IMPL_H */


   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 /*
  23  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2011, Joyent Inc. All rights reserved.
  25  */
  26 
  27 /*
  28  * Functions to maintain a table of datalink configuration information.
  29  */
  30 
  31 #ifndef _DLMGMT_IMPL_H
  32 #define _DLMGMT_IMPL_H
  33 
  34 #ifdef  __cplusplus
  35 extern "C" {
  36 #endif
  37 
  38 #include <door.h>
  39 #include <libdllink.h>
  40 #include <sys/avl.h>
  41 
  42 /*
  43  * datalink attribute structure
  44  */


  51         uint_t                          lp_sz;
  52         boolean_t                       lp_linkprop;
  53 } dlmgmt_linkattr_t;
  54 
  55 /*
  56  * datalink structure
  57  */
  58 typedef struct dlmgmt_link_s {
  59         dlmgmt_linkattr_t       *ll_head;
  60         char                    ll_link[MAXLINKNAMELEN];
  61         datalink_class_t        ll_class;
  62         uint32_t                ll_media;
  63         datalink_id_t           ll_linkid;
  64         zoneid_t                ll_zoneid;
  65         boolean_t               ll_onloan;
  66         avl_node_t              ll_name_node;
  67         avl_node_t              ll_id_node;
  68         avl_node_t              ll_loan_node;
  69         uint32_t                ll_flags;
  70         uint32_t                ll_gen;         /* generation number */
  71         boolean_t               ll_tomb;        /* tombstombed */
  72 } dlmgmt_link_t;
  73 
  74 /*
  75  * datalink configuration request structure
  76  */
  77 typedef struct dlmgmt_dlconf_s {
  78         dlmgmt_linkattr_t       *ld_head;
  79         char                    ld_link[MAXLINKNAMELEN];
  80         datalink_id_t           ld_linkid;
  81         datalink_class_t        ld_class;
  82         uint32_t                ld_media;
  83         int                     ld_id;
  84         zoneid_t                ld_zoneid;
  85         uint32_t                ld_gen;
  86         avl_node_t              ld_node;
  87 } dlmgmt_dlconf_t;
  88 
  89 #define ZONE_LOCK       "/etc/dladm/zone.lck"
  90 
  91 extern boolean_t        debug;
  92 extern const char       *progname;
  93 extern char             cachefile[];
  94 extern dladm_handle_t   dld_handle;
  95 extern datalink_id_t    dlmgmt_nextlinkid;
  96 extern avl_tree_t       dlmgmt_name_avl;
  97 extern avl_tree_t       dlmgmt_id_avl;
  98 extern avl_tree_t       dlmgmt_loan_avl;
  99 extern avl_tree_t       dlmgmt_dlconf_avl;
 100 
 101 boolean_t       linkattr_equal(dlmgmt_linkattr_t **, const char *, void *,
 102                     size_t);
 103 dlmgmt_linkattr_t *linkattr_find(dlmgmt_linkattr_t *, const char *);
 104 void            linkattr_unset(dlmgmt_linkattr_t **, const char *);
 105 int             linkattr_set(dlmgmt_linkattr_t **, const char *, void *,
 106                     size_t, dladm_datatype_t);
 107 int             linkattr_get(dlmgmt_linkattr_t **, const char *, void **,
 108                     size_t *, dladm_datatype_t *);
 109 void            linkattr_destroy(dlmgmt_link_t *);
 110 


 125 
 126 int             dlconf_create(const char *, datalink_id_t, datalink_class_t,
 127                     uint32_t, zoneid_t, dlmgmt_dlconf_t **);
 128 void            dlconf_destroy(dlmgmt_dlconf_t *);
 129 void            dlmgmt_advance_dlconfid(dlmgmt_dlconf_t *);
 130 void            dlmgmt_dlconf_table_lock(boolean_t);
 131 void            dlmgmt_dlconf_table_unlock(void);
 132 
 133 int             dlmgmt_generate_name(const char *, char *, size_t, zoneid_t);
 134 
 135 void            dlmgmt_linktable_init(void);
 136 void            dlmgmt_linktable_fini(void);
 137 
 138 int             dlmgmt_zone_init(zoneid_t);
 139 int             dlmgmt_elevate_privileges(void);
 140 int             dlmgmt_drop_privileges();
 141 void            dlmgmt_handler(void *, char *, size_t, door_desc_t *, uint_t);
 142 void            dlmgmt_log(int, const char *, ...);
 143 int             dlmgmt_write_db_entry(const char *, dlmgmt_link_t *, uint32_t);
 144 int             dlmgmt_delete_db_entry(dlmgmt_link_t *, uint32_t);
 145 int             dlmgmt_db_init(zoneid_t, char *);
 146 void            dlmgmt_db_fini(zoneid_t);
 147 
 148 #ifdef  __cplusplus
 149 }
 150 #endif
 151 
 152 #endif  /* _DLMGMT_IMPL_H */