Print this page
NEX-16219 pool import performance regression due to repeated libshare initialization
Reviewd by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-3673 CLONE NEX-2525 Customer cannot set Share Properties using MMC in Windows Server 2008 R2
Reviewed by: Alek Pinchuk <alek@nexenta.com>
SMB-50 User-mode SMB server
Includes work by these authors:
Thomas Keiser <thomas.keiser@nexenta.com>
Albert Lee <trisk@nexenta.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/lib/libshare/common/libshare.h
+++ new/usr/src/lib/libshare/common/libshare.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
|
↓ 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 (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
24 - * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
24 + * Copyright 2018 Nexenta Systems, Inc. All rights reserved.
25 25 * Copyright (c) 2016 by Delphix. All rights reserved.
26 26 */
27 27
28 28 /*
29 29 * basic API declarations for share management
30 30 */
31 31
32 32 #ifndef _LIBSHARE_H
33 33 #define _LIBSHARE_H
34 34
35 35 #ifdef __cplusplus
36 36 extern "C" {
37 37 #endif
38 38
39 39 #include <sys/types.h>
40 40 #include <sys/nvpair.h>
41 41 #include <libzfs.h>
42 42
43 43 /*
44 44 * Basic datatypes for most functions
45 45 */
46 46 typedef void *sa_group_t;
47 47 typedef void *sa_share_t;
48 48 typedef void *sa_property_t;
49 49 typedef void *sa_optionset_t;
50 50 typedef void *sa_security_t;
51 51 typedef void *sa_protocol_properties_t;
52 52 typedef void *sa_resource_t;
53 53
54 54 typedef void *sa_handle_t; /* opaque handle to access core functions */
55 55
56 56 /*
57 57 * defined error values
58 58 */
59 59
60 60 #define SA_OK 0
61 61 #define SA_NO_SUCH_PATH 1 /* provided path doesn't exist */
62 62 #define SA_NO_MEMORY 2 /* no memory for data structures */
63 63 #define SA_DUPLICATE_NAME 3 /* object name is already in use */
64 64 #define SA_BAD_PATH 4 /* not a full path */
65 65 #define SA_NO_SUCH_GROUP 5 /* group is not defined */
66 66 #define SA_CONFIG_ERR 6 /* system configuration error */
67 67 #define SA_SYSTEM_ERR 7 /* system error, use errno */
68 68 #define SA_SYNTAX_ERR 8 /* syntax error on command line */
69 69 #define SA_NO_PERMISSION 9 /* no permission for operation */
70 70 #define SA_BUSY 10 /* resource is busy */
71 71 #define SA_NO_SUCH_PROP 11 /* property doesn't exist */
72 72 #define SA_INVALID_NAME 12 /* name of object is invalid */
73 73 #define SA_INVALID_PROTOCOL 13 /* specified protocol not valid */
74 74 #define SA_NOT_ALLOWED 14 /* operation not allowed */
75 75 #define SA_BAD_VALUE 15 /* bad value for property */
76 76 #define SA_INVALID_SECURITY 16 /* invalid security type */
77 77 #define SA_NO_SUCH_SECURITY 17 /* security set not found */
78 78 #define SA_VALUE_CONFLICT 18 /* property value conflict */
79 79 #define SA_NOT_IMPLEMENTED 19 /* plugin interface not implemented */
80 80 #define SA_INVALID_PATH 20 /* path is sub-dir of existing share */
81 81 #define SA_NOT_SUPPORTED 21 /* operation not supported for proto */
82 82 #define SA_PROP_SHARE_ONLY 22 /* property valid on share only */
83 83 #define SA_NOT_SHARED 23 /* path is not shared */
84 84 #define SA_NO_SUCH_RESOURCE 24 /* resource not found */
85 85 #define SA_RESOURCE_REQUIRED 25 /* resource name is required */
86 86 #define SA_MULTIPLE_ERROR 26 /* multiple protocols reported error */
87 87 #define SA_PATH_IS_SUBDIR 27 /* check_path found path is subdir */
88 88 #define SA_PATH_IS_PARENTDIR 28 /* check_path found path is parent */
89 89 #define SA_NO_SECTION 29 /* protocol requires section info */
90 90 #define SA_NO_SUCH_SECTION 30 /* no section found */
91 91 #define SA_NO_PROPERTIES 31 /* no properties found */
92 92 #define SA_PASSWORD_ENC 32 /* passwords must be encrypted */
93 93 #define SA_SHARE_EXISTS 33 /* path or file is already shared */
94 94
95 95 /* API Initialization */
96 96 /* Both of these do not care about the value of arg in sa_init_arg */
97 97 #define SA_INIT_SHARE_API 0x0001 /* init share specific interface */
98 98 #define SA_INIT_CONTROL_API 0x0002 /* init control specific interface */
99 99
100 100 /* expects an sa_init_selective_arg_t as an argument */
101 101 #define SA_INIT_SHARE_API_SELECTIVE 0x0004 /* only some shares */
102 102 struct sa_init_selective_arg {
103 103 zfs_handle_t **zhandle_arr;
104 104 size_t zhandle_len;
105 105 };
106 106 typedef struct sa_init_selective_arg sa_init_selective_arg_t;
107 107
108 108
109 109 /*
110 110 * The SA_INIT_ONE_SHARE* initialization options to sa_init* will cause
111 111 * sa_needs_refrsh() to return true even if nothing else in the system has
112 112 * changed. If writing code that could possibly need to share/unshare multiple
113 113 * shares, it is recommended to use SA_INIT_SHARE_API_SELECTIVE.
114 114 */
115 115 /* Expects a single char * as input, the name of the share. */
116 116 #define SA_INIT_ONE_SHARE_FROM_NAME 0x0008
117 117
118 118 /* Expects a single zfs_handle_t as input, the handle of the share. */
119 119 #define SA_INIT_ONE_SHARE_FROM_HANDLE 0x0010
120 120
121 121 /* not part of API returns */
122 122 #define SA_LEGACY_ERR 32 /* share/unshare error return */
123 123
124 124 /*
125 125 * other defined values
126 126 */
127 127
128 128 #define SA_MAX_NAME_LEN 100 /* must fit service instance name */
129 129 #define SA_MAX_RESOURCE_NAME 255 /* Maximum length of resource name */
130 130
131 131 /* Used in calls to sa_add_share() and sa_add_resource() */
132 132 #define SA_SHARE_TRANSIENT 0 /* shared but not across reboot */
133 133 #define SA_SHARE_LEGACY 1 /* share is in dfstab only */
134 134 #define SA_SHARE_PERMANENT 2 /* share goes to repository */
135 135
136 136 /* sa_check_path() related */
137 137 #define SA_CHECK_NORMAL 0 /* only check against active shares */
138 138 #define SA_CHECK_STRICT 1 /* check against all shares */
139 139
140 140 /* RBAC related */
141 141 #define SA_RBAC_MANAGE "solaris.smf.manage.shares"
142 142 #define SA_RBAC_VALUE "solaris.smf.value.shares"
143 143
144 144 /*
145 145 * Feature set bit definitions
146 146 */
147 147
148 148 #define SA_FEATURE_NONE 0x0000 /* no feature flags set */
149 149 #define SA_FEATURE_RESOURCE 0x0001 /* resource names are required */
150 150 #define SA_FEATURE_DFSTAB 0x0002 /* need to manage in dfstab */
151 151 #define SA_FEATURE_ALLOWSUBDIRS 0x0004 /* allow subdirs to be shared */
152 152 #define SA_FEATURE_ALLOWPARDIRS 0x0008 /* allow parent dirs to be shared */
153 153 #define SA_FEATURE_HAS_SECTIONS 0x0010 /* protocol supports sections */
154 154 #define SA_FEATURE_ADD_PROPERTIES 0x0020 /* can add properties */
155 155 #define SA_FEATURE_SERVER 0x0040 /* protocol supports server mode */
156 156
157 157 /*
158 158 * legacy files
159 159 */
160 160
161 161 #define SA_LEGACY_DFSTAB "/etc/dfs/dfstab"
162 162 #define SA_LEGACY_SHARETAB "/etc/dfs/sharetab"
163 163
|
↓ open down ↓ |
129 lines elided |
↑ open up ↑ |
164 164 /*
165 165 * SMF related
166 166 */
167 167
168 168 #define SA_SVC_FMRI_BASE "svc:/network/shares/group"
169 169
170 170 /* initialization */
171 171 extern sa_handle_t sa_init(int);
172 172 extern sa_handle_t sa_init_arg(int, void *);
173 173 extern void sa_fini(sa_handle_t);
174 +extern int sa_service(sa_handle_t);
175 +
174 176 extern int sa_update_config(sa_handle_t);
175 177 extern boolean_t sa_needs_refresh(sa_handle_t);
176 178 extern char *sa_errorstr(int);
177 179
178 180 /* protocol names */
179 181 extern int sa_get_protocols(char ***);
180 182 extern int sa_valid_protocol(char *);
181 183
182 184 /* group control (create, remove, etc) */
183 185 extern sa_group_t sa_create_group(sa_handle_t, char *, int *);
184 186 extern int sa_remove_group(sa_group_t);
185 187 extern sa_group_t sa_get_group(sa_handle_t, char *);
186 188 extern sa_group_t sa_get_next_group(sa_group_t);
187 189 extern char *sa_get_group_attr(sa_group_t, char *);
188 190 extern int sa_set_group_attr(sa_group_t, char *, char *);
189 191 extern sa_group_t sa_get_sub_group(sa_group_t);
190 192 extern int sa_valid_group_name(char *);
191 193
192 194 /* share control */
193 195 extern sa_share_t sa_add_share(sa_group_t, char *, int, int *);
194 196 extern int sa_check_path(sa_group_t, char *, int);
195 197 extern int sa_move_share(sa_group_t, sa_share_t);
196 198 extern int sa_remove_share(sa_share_t);
197 199 extern sa_share_t sa_get_share(sa_group_t, char *);
198 200 extern sa_share_t sa_find_share(sa_handle_t, char *);
199 201 extern sa_share_t sa_get_next_share(sa_share_t);
200 202 extern char *sa_get_share_attr(sa_share_t, char *);
201 203 extern char *sa_get_share_description(sa_share_t);
202 204 extern sa_group_t sa_get_parent_group(sa_share_t);
203 205 extern int sa_set_share_attr(sa_share_t, char *, char *);
204 206 extern int sa_set_share_description(sa_share_t, char *);
205 207 extern int sa_enable_share(sa_group_t, char *);
206 208 extern int sa_disable_share(sa_share_t, char *);
207 209 extern int sa_is_share(void *);
208 210
209 211 /* resource name related */
210 212 extern sa_resource_t sa_find_resource(sa_handle_t, char *);
211 213 extern sa_resource_t sa_get_resource(sa_group_t, char *);
212 214 extern sa_resource_t sa_get_next_resource(sa_resource_t);
213 215 extern sa_share_t sa_get_resource_parent(sa_resource_t);
214 216 extern sa_resource_t sa_get_share_resource(sa_share_t, char *);
215 217 extern sa_resource_t sa_add_resource(sa_share_t, char *, int, int *);
216 218 extern int sa_remove_resource(sa_resource_t);
217 219 extern char *sa_get_resource_attr(sa_resource_t, char *);
218 220 extern int sa_set_resource_attr(sa_resource_t, char *, char *);
219 221 extern int sa_set_resource_description(sa_resource_t, char *);
220 222 extern char *sa_get_resource_description(sa_resource_t);
221 223 extern int sa_enable_resource(sa_resource_t, char *);
222 224 extern int sa_disable_resource(sa_resource_t, char *);
223 225 extern int sa_rename_resource(sa_resource_t, char *);
224 226 extern void sa_fix_resource_name(char *);
225 227
226 228 /* data structure free calls */
227 229 extern void sa_free_attr_string(char *);
228 230 extern void sa_free_share_description(char *);
229 231
230 232 /* optionset control */
231 233 extern sa_optionset_t sa_get_optionset(sa_group_t, char *);
232 234 extern sa_optionset_t sa_get_next_optionset(sa_group_t);
233 235 extern char *sa_get_optionset_attr(sa_optionset_t, char *);
234 236 extern void sa_set_optionset_attr(sa_optionset_t, char *, char *);
235 237 extern sa_optionset_t sa_create_optionset(sa_group_t, char *);
236 238 extern int sa_destroy_optionset(sa_optionset_t);
237 239 extern sa_optionset_t sa_get_derived_optionset(void *, char *, int);
238 240 extern void sa_free_derived_optionset(sa_optionset_t);
239 241
240 242 /* property functions */
241 243 extern sa_property_t sa_get_property(sa_optionset_t, char *);
242 244 extern sa_property_t sa_get_next_property(sa_group_t);
243 245 extern char *sa_get_property_attr(sa_property_t, char *);
244 246 extern sa_property_t sa_create_section(char *, char *);
245 247 extern void sa_set_section_attr(sa_property_t, char *, char *);
246 248 extern sa_property_t sa_create_property(char *, char *);
247 249 extern int sa_add_property(void *, sa_property_t);
248 250 extern int sa_update_property(sa_property_t, char *);
249 251 extern int sa_remove_property(sa_property_t);
250 252 extern int sa_commit_properties(sa_optionset_t, int);
251 253 extern int sa_valid_property(sa_handle_t, void *, char *, sa_property_t);
252 254 extern int sa_is_persistent(void *);
253 255
254 256 /* security control */
255 257 extern sa_security_t sa_get_security(sa_group_t, char *, char *);
256 258 extern sa_security_t sa_get_next_security(sa_security_t);
257 259 extern char *sa_get_security_attr(sa_optionset_t, char *);
258 260 extern sa_security_t sa_create_security(sa_group_t, char *, char *);
259 261 extern int sa_destroy_security(sa_security_t);
260 262 extern void sa_set_security_attr(sa_security_t, char *, char *);
261 263 extern sa_optionset_t sa_get_all_security_types(void *, char *, int);
262 264 extern sa_security_t sa_get_derived_security(void *, char *, char *, int);
263 265 extern void sa_free_derived_security(sa_security_t);
264 266
265 267 /* protocol specific interfaces */
266 268 extern int sa_parse_legacy_options(sa_group_t, char *, char *);
267 269 extern char *sa_proto_legacy_format(char *, sa_group_t, int);
268 270 extern int sa_is_security(char *, char *);
269 271 extern sa_protocol_properties_t sa_proto_get_properties(char *);
270 272 extern uint64_t sa_proto_get_featureset(char *);
271 273 extern sa_property_t sa_get_protocol_section(sa_protocol_properties_t, char *);
272 274 extern sa_property_t sa_get_next_protocol_section(sa_property_t, char *);
273 275 extern sa_property_t sa_get_protocol_property(sa_protocol_properties_t, char *);
274 276 extern sa_property_t sa_get_next_protocol_property(sa_property_t, char *);
275 277 extern int sa_set_protocol_property(sa_property_t, char *, char *);
276 278 extern char *sa_get_protocol_status(char *);
277 279 extern void sa_format_free(char *);
278 280 extern sa_protocol_properties_t sa_create_protocol_properties(char *);
279 281 extern int sa_add_protocol_property(sa_protocol_properties_t, sa_property_t);
280 282 extern int sa_proto_valid_prop(sa_handle_t, char *, sa_property_t,
281 283 sa_optionset_t);
282 284 extern int sa_proto_valid_space(char *, char *);
283 285 extern char *sa_proto_space_alias(char *, char *);
284 286 extern int sa_proto_get_transients(sa_handle_t, char *);
285 287 extern int sa_proto_notify_resource(sa_resource_t, char *);
286 288 extern int sa_proto_change_notify(sa_share_t, char *);
287 289 extern int sa_proto_delete_section(char *, char *);
288 290
289 291 /* handle legacy (dfstab/sharetab) files */
290 292 extern int sa_delete_legacy(sa_share_t, char *);
291 293 extern int sa_update_legacy(sa_share_t, char *);
292 294 extern int sa_update_sharetab(sa_share_t, char *);
293 295 extern int sa_delete_sharetab(sa_handle_t, char *, char *);
294 296
295 297 /* ZFS functions */
296 298 extern int sa_zfs_is_shared(sa_handle_t, char *);
297 299 extern int sa_group_is_zfs(sa_group_t);
298 300 extern int sa_path_is_zfs(char *);
299 301 extern int sa_zfs_setprop(sa_handle_t, char *, nvlist_t *);
300 302
301 303 /* SA Handle specific functions */
302 304 extern sa_handle_t sa_find_group_handle(sa_group_t);
303 305
304 306 #ifdef __cplusplus
305 307 }
306 308 #endif
307 309
308 310 #endif /* _LIBSHARE_H */
|
↓ open down ↓ |
125 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX