Bug Summary

File:xlators/mgmt/glusterd/src/glusterd-volume-set.c
Location:line 64, column 16
Description:Access to field 'private' results in a dereference of a null pointer (loaded from variable 'this')

Annotated Source Code

1/*
2 Copyright (c) 2013 Red Hat, Inc. <http://www.redhat.com>
3 This file is part of GlusterFS.
4
5 This file is licensed to you under your choice of the GNU Lesser
6 General Public License, version 3 or any later version (LGPLv3 or
7 later), or the GNU General Public License, version 2 (GPLv2), in all
8 cases as published by the Free Software Foundation.
9*/
10
11#ifndef _CONFIG_H
12#define _CONFIG_H
13#include "config.h"
14#endif
15
16#include "glusterd-volgen.h"
17#include "glusterd-utils.h"
18
19static int
20check_dict_key_value (dict_t *dict, char *key, char *value)
21{
22 glusterd_conf_t *priv = NULL((void*)0);
23 int ret = 0;
24 xlator_t *this = NULL((void*)0);
25
26 this = THIS(*__glusterfs_this_location());
27 GF_ASSERT (this)do { if (!(this)) { do { do { if (0) printf ("Assertion failed: "
"this"); } while (0); _gf_log_callingfn ("", "glusterd-volume-set.c"
, __FUNCTION__, 27, GF_LOG_ERROR, "Assertion failed: " "this"
); } while (0); } } while (0)
;
28 priv = this->private;
29 GF_ASSERT (priv)do { if (!(priv)) { do { do { if (0) printf ("Assertion failed: "
"priv"); } while (0); _gf_log_callingfn ("", "glusterd-volume-set.c"
, __FUNCTION__, 29, GF_LOG_ERROR, "Assertion failed: " "priv"
); } while (0); } } while (0)
;
30
31 if (!dict) {
32 gf_log (this->name, GF_LOG_ERROR, "Received Empty Dict.")do { do { if (0) printf ("Received Empty Dict."); } while (0)
; _gf_log (this->name, "glusterd-volume-set.c", __FUNCTION__
, 32, GF_LOG_ERROR, "Received Empty Dict."); } while (0)
;
33 ret = -1;
34 goto out;
35 }
36
37 if (!key) {
38 gf_log (this->name, GF_LOG_ERROR, "Received Empty Key.")do { do { if (0) printf ("Received Empty Key."); } while (0);
_gf_log (this->name, "glusterd-volume-set.c", __FUNCTION__
, 38, GF_LOG_ERROR, "Received Empty Key."); } while (0)
;
39 ret = -1;
40 goto out;
41 }
42
43 if (!value) {
44 gf_log (this->name, GF_LOG_ERROR, "Received Empty Value.")do { do { if (0) printf ("Received Empty Value."); } while (0
); _gf_log (this->name, "glusterd-volume-set.c", __FUNCTION__
, 44, GF_LOG_ERROR, "Received Empty Value."); } while (0)
;
45 ret = -1;
46 goto out;
47 }
48
49out:
50 gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret)do { do { if (0) printf ("Returning %d", ret); } while (0); _gf_log
(this->name, "glusterd-volume-set.c", __FUNCTION__, 50, GF_LOG_DEBUG
, "Returning %d", ret); } while (0)
;
51
52 return ret;
53}
54
55static int
56get_volname_volinfo (dict_t *dict, char **volname, glusterd_volinfo_t **volinfo)
57{
58 glusterd_conf_t *priv = NULL((void*)0);
59 int ret = 0;
60 xlator_t *this = NULL((void*)0);
61
62 this = THIS(*__glusterfs_this_location());
3
Value assigned to 'this'
63 GF_ASSERT (this)do { if (!(this)) { do { do { if (0) printf ("Assertion failed: "
"this"); } while (0); _gf_log_callingfn ("", "glusterd-volume-set.c"
, __FUNCTION__, 63, GF_LOG_ERROR, "Assertion failed: " "this"
); } while (0); } } while (0)
;
4
Within the expansion of the macro 'GF_ASSERT':
a
Assuming 'this' is null
64 priv = this->private;
5
Access to field 'private' results in a dereference of a null pointer (loaded from variable 'this')
65 GF_ASSERT (priv)do { if (!(priv)) { do { do { if (0) printf ("Assertion failed: "
"priv"); } while (0); _gf_log_callingfn ("", "glusterd-volume-set.c"
, __FUNCTION__, 65, GF_LOG_ERROR, "Assertion failed: " "priv"
); } while (0); } } while (0)
;
66
67 ret = dict_get_str (dict, "volname", volname);
68 if (ret) {
69 gf_log (this->name, GF_LOG_ERROR, "Unable to get volume name")do { do { if (0) printf ("Unable to get volume name"); } while
(0); _gf_log (this->name, "glusterd-volume-set.c", __FUNCTION__
, 69, GF_LOG_ERROR, "Unable to get volume name"); } while (0)
;
70 goto out;
71 }
72
73 ret = glusterd_volinfo_find (*volname, volinfo);
74 if (ret) {
75 gf_log (this->name, GF_LOG_ERROR, "Unable to allocate memory")do { do { if (0) printf ("Unable to allocate memory"); } while
(0); _gf_log (this->name, "glusterd-volume-set.c", __FUNCTION__
, 75, GF_LOG_ERROR, "Unable to allocate memory"); } while (0)
;
76 goto out;
77 }
78
79out:
80 gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret)do { do { if (0) printf ("Returning %d", ret); } while (0); _gf_log
(this->name, "glusterd-volume-set.c", __FUNCTION__, 80, GF_LOG_DEBUG
, "Returning %d", ret); } while (0)
;
81
82 return ret;
83}
84
85static int
86validate_cache_max_min_size (dict_t *dict, char *key, char *value,
87 char **op_errstr)
88{
89 char *current_max_value = NULL((void*)0);
90 char *current_min_value = NULL((void*)0);
91 char errstr[2048] = "";
92 char *volname = NULL((void*)0);
93 glusterd_conf_t *priv = NULL((void*)0);
94 glusterd_volinfo_t *volinfo = NULL((void*)0);
95 int ret = 0;
96 uint64_t max_value = 0;
97 uint64_t min_value = 0;
98 xlator_t *this = NULL((void*)0);
99
100 this = THIS(*__glusterfs_this_location());
101 GF_ASSERT (this)do { if (!(this)) { do { do { if (0) printf ("Assertion failed: "
"this"); } while (0); _gf_log_callingfn ("", "glusterd-volume-set.c"
, __FUNCTION__, 101, GF_LOG_ERROR, "Assertion failed: " "this"
); } while (0); } } while (0)
;
102 priv = this->private;
103 GF_ASSERT (priv)do { if (!(priv)) { do { do { if (0) printf ("Assertion failed: "
"priv"); } while (0); _gf_log_callingfn ("", "glusterd-volume-set.c"
, __FUNCTION__, 103, GF_LOG_ERROR, "Assertion failed: " "priv"
); } while (0); } } while (0)
;
104
105 ret = check_dict_key_value (dict, key, value);
106 if (ret)
107 goto out;
108
109 ret = get_volname_volinfo (dict, &volname, &volinfo);
110 if (ret)
111 goto out;
112
113 if ((!strcmp (key, "performance.cache-min-file-size")) ||
114 (!strcmp (key, "cache-min-file-size"))) {
115 glusterd_volinfo_get (volinfo,
116 "performance.cache-max-file-size",
117 &current_max_value);
118 if (current_max_value) {
119 gf_string2bytesize (current_max_value, &max_value);
120 gf_string2bytesize (value, &min_value);
121 current_min_value = value;
122 }
123 } else if ((!strcmp (key, "performance.cache-max-file-size")) ||
124 (!strcmp (key, "cache-max-file-size"))) {
125 glusterd_volinfo_get (volinfo,
126 "performance.cache-min-file-size",
127 &current_min_value);
128 if (current_min_value) {
129 gf_string2bytesize (current_min_value, &min_value);
130 gf_string2bytesize (value, &max_value);
131 current_max_value = value;
132 }
133 }
134
135 if (min_value > max_value) {
136 snprintf (errstr, sizeof (errstr),
137 "cache-min-file-size (%s) is greater than "
138 "cache-max-file-size (%s)",
139 current_min_value, current_max_value);
140 gf_log (this->name, GF_LOG_ERROR, "%s", errstr)do { do { if (0) printf ("%s", errstr); } while (0); _gf_log (
this->name, "glusterd-volume-set.c", __FUNCTION__, 140, GF_LOG_ERROR
, "%s", errstr); } while (0)
;
141 *op_errstr = gf_strdup (errstr);
142 ret = -1;
143 goto out;
144 }
145
146out:
147 gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret)do { do { if (0) printf ("Returning %d", ret); } while (0); _gf_log
(this->name, "glusterd-volume-set.c", __FUNCTION__, 147, GF_LOG_DEBUG
, "Returning %d", ret); } while (0)
;
148
149 return ret;
150}
151
152static int
153validate_quota (dict_t *dict, char *key, char *value,
154 char **op_errstr)
155{
156 char errstr[2048] = "";
157 char *volname = NULL((void*)0);
158 glusterd_conf_t *priv = NULL((void*)0);
159 glusterd_volinfo_t *volinfo = NULL((void*)0);
160 int ret = 0;
161 xlator_t *this = NULL((void*)0);
162
163 this = THIS(*__glusterfs_this_location());
164 GF_ASSERT (this)do { if (!(this)) { do { do { if (0) printf ("Assertion failed: "
"this"); } while (0); _gf_log_callingfn ("", "glusterd-volume-set.c"
, __FUNCTION__, 164, GF_LOG_ERROR, "Assertion failed: " "this"
); } while (0); } } while (0)
;
165 priv = this->private;
166 GF_ASSERT (priv)do { if (!(priv)) { do { do { if (0) printf ("Assertion failed: "
"priv"); } while (0); _gf_log_callingfn ("", "glusterd-volume-set.c"
, __FUNCTION__, 166, GF_LOG_ERROR, "Assertion failed: " "priv"
); } while (0); } } while (0)
;
167
168 ret = check_dict_key_value (dict, key, value);
169 if (ret)
170 goto out;
171
172 ret = get_volname_volinfo (dict, &volname, &volinfo);
173 if (ret)
174 goto out;
175
176 ret = glusterd_volinfo_get_boolean (volinfo, VKEY_FEATURES_QUOTA"features.quota");
177 if (ret == -1) {
178 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("failed to get the quota status"); }
while (0); _gf_log (this->name, "glusterd-volume-set.c", __FUNCTION__
, 179, GF_LOG_ERROR, "failed to get the quota status"); } while
(0)
179 "failed to get the quota status")do { do { if (0) printf ("failed to get the quota status"); }
while (0); _gf_log (this->name, "glusterd-volume-set.c", __FUNCTION__
, 179, GF_LOG_ERROR, "failed to get the quota status"); } while
(0)
;
180 goto out;
181 }
182
183 if (ret == _gf_false) {
184 snprintf (errstr, sizeof (errstr),
185 "Cannot set %s. Enable quota first.", key);
186 gf_log (this->name, GF_LOG_ERROR, "%s", errstr)do { do { if (0) printf ("%s", errstr); } while (0); _gf_log (
this->name, "glusterd-volume-set.c", __FUNCTION__, 186, GF_LOG_ERROR
, "%s", errstr); } while (0)
;
187 *op_errstr = gf_strdup (errstr);
188 ret = -1;
189 goto out;
190 }
191
192 ret = 0;
193out:
194 gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret)do { do { if (0) printf ("Returning %d", ret); } while (0); _gf_log
(this->name, "glusterd-volume-set.c", __FUNCTION__, 194, GF_LOG_DEBUG
, "Returning %d", ret); } while (0)
;
195
196 return ret;
197}
198
199static int
200validate_stripe (dict_t *dict, char *key, char *value, char **op_errstr)
201{
202 char errstr[2048] = "";
203 char *volname = NULL((void*)0);
204 glusterd_conf_t *priv = NULL((void*)0);
205 glusterd_volinfo_t *volinfo = NULL((void*)0);
206 int ret = 0;
207 xlator_t *this = NULL((void*)0);
208
209 this = THIS(*__glusterfs_this_location());
210 GF_ASSERT (this)do { if (!(this)) { do { do { if (0) printf ("Assertion failed: "
"this"); } while (0); _gf_log_callingfn ("", "glusterd-volume-set.c"
, __FUNCTION__, 210, GF_LOG_ERROR, "Assertion failed: " "this"
); } while (0); } } while (0)
;
211 priv = this->private;
212 GF_ASSERT (priv)do { if (!(priv)) { do { do { if (0) printf ("Assertion failed: "
"priv"); } while (0); _gf_log_callingfn ("", "glusterd-volume-set.c"
, __FUNCTION__, 212, GF_LOG_ERROR, "Assertion failed: " "priv"
); } while (0); } } while (0)
;
213
214 ret = check_dict_key_value (dict, key, value);
215 if (ret)
216 goto out;
217
218 ret = get_volname_volinfo (dict, &volname, &volinfo);
219 if (ret)
220 goto out;
221
222 if (volinfo->stripe_count == 1) {
223 snprintf (errstr, sizeof (errstr),
224 "Cannot set %s for a non-stripe volume.", key);
225 gf_log (this->name, GF_LOG_ERROR, "%s", errstr)do { do { if (0) printf ("%s", errstr); } while (0); _gf_log (
this->name, "glusterd-volume-set.c", __FUNCTION__, 225, GF_LOG_ERROR
, "%s", errstr); } while (0)
;
226 *op_errstr = gf_strdup (errstr);
227 ret = -1;
228 goto out;
229 }
230
231out:
232 gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret)do { do { if (0) printf ("Returning %d", ret); } while (0); _gf_log
(this->name, "glusterd-volume-set.c", __FUNCTION__, 232, GF_LOG_DEBUG
, "Returning %d", ret); } while (0)
;
233
234 return ret;
235}
236
237static int
238validate_subvols_per_directory (dict_t *dict, char *key, char *value,
239 char **op_errstr)
240{
241 char errstr[2048] = "";
242 char *volname = NULL((void*)0);
243 glusterd_conf_t *priv = NULL((void*)0);
244 glusterd_volinfo_t *volinfo = NULL((void*)0);
245 int ret = 0;
246 int subvols = 0;
247 xlator_t *this = NULL((void*)0);
248
249 this = THIS(*__glusterfs_this_location());
250 GF_ASSERT (this)do { if (!(this)) { do { do { if (0) printf ("Assertion failed: "
"this"); } while (0); _gf_log_callingfn ("", "glusterd-volume-set.c"
, __FUNCTION__, 250, GF_LOG_ERROR, "Assertion failed: " "this"
); } while (0); } } while (0)
;
251 priv = this->private;
252 GF_ASSERT (priv)do { if (!(priv)) { do { do { if (0) printf ("Assertion failed: "
"priv"); } while (0); _gf_log_callingfn ("", "glusterd-volume-set.c"
, __FUNCTION__, 252, GF_LOG_ERROR, "Assertion failed: " "priv"
); } while (0); } } while (0)
;
253
254 ret = check_dict_key_value (dict, key, value);
255 if (ret)
1
Taking false branch
256 goto out;
257
258 ret = get_volname_volinfo (dict, &volname, &volinfo);
2
Calling 'get_volname_volinfo'
259 if (ret)
260 goto out;
261
262 subvols = atoi(value);
263
264 /* Checking if the subvols-per-directory exceed the total
265 number of subvolumes. */
266 if (subvols > volinfo->subvol_count) {
267 snprintf (errstr, sizeof(errstr),
268 "subvols-per-directory(%d) is greater "
269 "than the number of subvolumes(%d).",
270 subvols, volinfo->subvol_count);
271 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("%s.", errstr); } while (0); _gf_log
(this->name, "glusterd-volume-set.c", __FUNCTION__, 272, GF_LOG_ERROR
, "%s.", errstr); } while (0)
272 "%s.", errstr)do { do { if (0) printf ("%s.", errstr); } while (0); _gf_log
(this->name, "glusterd-volume-set.c", __FUNCTION__, 272, GF_LOG_ERROR
, "%s.", errstr); } while (0)
;
273 *op_errstr = gf_strdup (errstr);
274 ret = -1;
275 goto out;
276 }
277
278out:
279 gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret)do { do { if (0) printf ("Returning %d", ret); } while (0); _gf_log
(this->name, "glusterd-volume-set.c", __FUNCTION__, 279, GF_LOG_DEBUG
, "Returning %d", ret); } while (0)
;
280
281 return ret;
282}
283
284
285/* dispatch table for VOLUME SET
286 * -----------------------------
287 *
288 * Format of entries:
289 *
290 * First field is the <key>, for the purpose of looking it up
291 * in volume dictionary. Each <key> is of the format "<domain>.<specifier>".
292 *
293 * Second field is <voltype>.
294 *
295 * Third field is <option>, if its unset, it's assumed to be
296 * the same as <specifier>.
297 *
298 * Fourth field is <value>. In this context they are used to specify
299 * a default. That is, even the volume dict doesn't have a value,
300 * we procced as if the default value were set for it.
301 *
302 * Fifth field is <doctype>, which decides if the option is public and available
303 * in "set help" or not. "NO_DOC" entries are not part of the public interface
304 * and are subject to change at any time. This also decides if an option is
305 * global (apllies to all volumes) or normal (applies to only specified volume).
306 *
307 * Sixth field is <flags>.
308 *
309 * Seventh field is <op-version>.
310 *
311 * Eight field is description of option: If NULL, tried to fetch from
312 * translator code's xlator_options table.
313 *
314 * Nineth field is validation function: If NULL, xlator's option specific
315 * validation will be tried, otherwise tried at glusterd code itself.
316 *
317 * There are two type of entries: basic and special.
318 *
319 * - Basic entries are the ones where the <option> does _not_ start with
320 * the bang! character ('!').
321 *
322 * In their case, <option> is understood as an option for an xlator of
323 * type <voltype>. Their effect is to copy over the volinfo->dict[<key>]
324 * value to all graph nodes of type <voltype> (if such a value is set).
325 *
326 * You are free to add entries of this type, they will become functional
327 * just by being present in the table.
328 *
329 * - Special entries where the <option> starts with the bang!.
330 *
331 * They are not applied to all graphs during generation, and you cannot
332 * extend them in a trivial way which could be just picked up. Better
333 * not touch them unless you know what you do.
334 *
335 *
336 * Another kind of grouping for options, according to visibility:
337 *
338 * - Exported: one which is used in the code. These are characterized by
339 * being used a macro as <key> (of the format VKEY_..., defined in
340 * glusterd-volgen.h
341 *
342 * - Non-exported: the rest; these have string literal <keys>.
343 *
344 * Adhering to this policy, option name changes shall be one-liners.
345 *
346 */
347
348struct volopt_map_entry glusterd_volopt_map[] = {
349 /* DHT xlator options */
350 { .key = "cluster.lookup-unhashed",
351 .voltype = "cluster/distribute",
352 .op_version = 1,
353 .client_option = _gf_true
354 },
355 { .key = "cluster.min-free-disk",
356 .voltype = "cluster/distribute",
357 .op_version = 1,
358 .client_option = _gf_true
359 },
360 { .key = "cluster.min-free-inodes",
361 .voltype = "cluster/distribute",
362 .op_version = 1,
363 .client_option = _gf_true
364 },
365 { .key = "cluster.rebalance-stats",
366 .voltype = "cluster/distribute",
367 .op_version = 2,
368 .client_option = _gf_true
369 },
370 { .key = "cluster.subvols-per-directory",
371 .voltype = "cluster/distribute",
372 .option = "directory-layout-spread",
373 .op_version = 2,
374 .validate_fn = validate_subvols_per_directory,
375 .client_option = _gf_true
376 },
377 { .key = "cluster.readdir-optimize",
378 .voltype = "cluster/distribute",
379 .op_version = 2,
380 .client_option = _gf_true
381 },
382 { .key = "cluster.nufa",
383 .voltype = "cluster/distribute",
384 .option = "!nufa",
385 .type = NO_DOC,
386 .op_version = 2,
387 .client_option = _gf_true
388 },
389 { .key = "cluster.rsync-hash-regex",
390 .voltype = "cluster/distribute",
391 .type = NO_DOC,
392 .op_version = 2,
393 .client_option = _gf_true
394 },
395 { .key = "cluster.extra-hash-regex",
396 .voltype = "cluster/distribute",
397 .type = NO_DOC,
398 .op_version = 2,
399 .client_option = _gf_true
400 },
401 { .key = "cluster.dht-xattr-name",
402 .voltype = "cluster/distribute",
403 .option = "xattr-name",
404 .type = NO_DOC,
405 .op_version = 2,
406 .client_option = _gf_true
407 },
408
409 /* AFR xlator options */
410 { .key = "cluster.entry-change-log",
411 .voltype = "cluster/replicate",
412 .op_version = 1,
413 .client_option = _gf_true
414 },
415 { .key = "cluster.read-subvolume",
416 .voltype = "cluster/replicate",
417 .op_version = 1,
418 .client_option = _gf_true
419 },
420 { .key = "cluster.read-subvolume-index",
421 .voltype = "cluster/replicate",
422 .op_version = 2,
423 .client_option = _gf_true
424 },
425 { .key = "cluster.read-hash-mode",
426 .voltype = "cluster/replicate",
427 .op_version = 2,
428 .client_option = _gf_true
429 },
430 { .key = "cluster.background-self-heal-count",
431 .voltype = "cluster/replicate",
432 .op_version = 1,
433 .client_option = _gf_true
434 },
435 { .key = "cluster.metadata-self-heal",
436 .voltype = "cluster/replicate",
437 .op_version = 1,
438 .client_option = _gf_true
439 },
440 { .key = "cluster.data-self-heal",
441 .voltype = "cluster/replicate",
442 .op_version = 1,
443 .client_option = _gf_true
444 },
445 { .key = "cluster.entry-self-heal",
446 .voltype = "cluster/replicate",
447 .op_version = 1,
448 .client_option = _gf_true
449 },
450 { .key = "cluster.self-heal-daemon",
451 .voltype = "cluster/replicate",
452 .option = "!self-heal-daemon",
453 .op_version = 1
454 },
455 { .key = "cluster.heal-timeout",
456 .voltype = "cluster/replicate",
457 .option = "!heal-timeout",
458 .op_version = 2,
459 .client_option = _gf_true
460 },
461 { .key = "cluster.strict-readdir",
462 .voltype = "cluster/replicate",
463 .type = NO_DOC,
464 .op_version = 1,
465 .client_option = _gf_true
466 },
467 { .key = "cluster.self-heal-window-size",
468 .voltype = "cluster/replicate",
469 .option = "data-self-heal-window-size",
470 .op_version = 1,
471 .client_option = _gf_true
472 },
473 { .key = "cluster.data-change-log",
474 .voltype = "cluster/replicate",
475 .op_version = 1,
476 .client_option = _gf_true
477 },
478 { .key = "cluster.metadata-change-log",
479 .voltype = "cluster/replicate",
480 .op_version = 1,
481 .client_option = _gf_true
482 },
483 { .key = "cluster.data-self-heal-algorithm",
484 .voltype = "cluster/replicate",
485 .option = "data-self-heal-algorithm",
486 .op_version = 1,
487 .client_option = _gf_true
488 },
489 { .key = "cluster.eager-lock",
490 .voltype = "cluster/replicate",
491 .op_version = 1,
492 .client_option = _gf_true
493 },
494 { .key = "cluster.quorum-type",
495 .voltype = "cluster/replicate",
496 .option = "quorum-type",
497 .op_version = 1,
498 .client_option = _gf_true
499 },
500 { .key = "cluster.quorum-count",
501 .voltype = "cluster/replicate",
502 .option = "quorum-count",
503 .op_version = 1,
504 .client_option = _gf_true
505 },
506 { .key = "cluster.choose-local",
507 .voltype = "cluster/replicate",
508 .op_version = 2,
509 .client_option = _gf_true
510 },
511 { .key = "cluster.self-heal-readdir-size",
512 .voltype = "cluster/replicate",
513 .op_version = 2,
514 .client_option = _gf_true
515 },
516 { .key = "cluster.post-op-delay-secs",
517 .voltype = "cluster/replicate",
518 .type = NO_DOC,
519 .op_version = 2,
520 .client_option = _gf_true
521 },
522 { .key = "cluster.readdir-failover",
523 .voltype = "cluster/replicate",
524 .op_version = 2,
525 .client_option = _gf_true
526 },
527
528 /* Stripe xlator options */
529 { .key = "cluster.stripe-block-size",
530 .voltype = "cluster/stripe",
531 .option = "block-size",
532 .op_version = 1,
533 .validate_fn = validate_stripe,
534 .client_option = _gf_true
535 },
536 { .key = "cluster.stripe-coalesce",
537 .voltype = "cluster/stripe",
538 .option = "coalesce",
539 .op_version = 2,
540 .client_option = _gf_true
541 },
542
543 /* IO-stats xlator options */
544 { .key = VKEY_DIAG_LAT_MEASUREMENT"diagnostics.latency-measurement",
545 .voltype = "debug/io-stats",
546 .option = "latency-measurement",
547 .value = "off",
548 .op_version = 1
549 },
550 { .key = "diagnostics.dump-fd-stats",
551 .voltype = "debug/io-stats",
552 .op_version = 1
553 },
554 { .key = VKEY_DIAG_CNT_FOP_HITS"diagnostics.count-fop-hits",
555 .voltype = "debug/io-stats",
556 .option = "count-fop-hits",
557 .value = "off",
558 .type = NO_DOC,
559 .op_version = 1
560 },
561 { .key = "diagnostics.brick-log-level",
562 .voltype = "debug/io-stats",
563 .option = "!brick-log-level",
564 .op_version = 1
565 },
566 { .key = "diagnostics.client-log-level",
567 .voltype = "debug/io-stats",
568 .option = "!client-log-level",
569 .op_version = 1,
570 .client_option = _gf_true
571 },
572 { .key = "diagnostics.brick-sys-log-level",
573 .voltype = "debug/io-stats",
574 .option = "!sys-log-level",
575 .op_version = 1
576 },
577 { .key = "diagnostics.client-sys-log-level",
578 .voltype = "debug/io-stats",
579 .option = "!sys-log-level",
580 .op_version = 1,
581 .client_option = _gf_true
582 },
583
584 /* IO-cache xlator options */
585 { .key = "performance.cache-max-file-size",
586 .voltype = "performance/io-cache",
587 .option = "max-file-size",
588 .op_version = 1,
589 .validate_fn = validate_cache_max_min_size,
590 .client_option = _gf_true
591 },
592 { .key = "performance.cache-min-file-size",
593 .voltype = "performance/io-cache",
594 .option = "min-file-size",
595 .op_version = 1,
596 .validate_fn = validate_cache_max_min_size,
597 .client_option = _gf_true
598 },
599 { .key = "performance.cache-refresh-timeout",
600 .voltype = "performance/io-cache",
601 .option = "cache-timeout",
602 .op_version = 1,
603 .client_option = _gf_true
604 },
605 { .key = "performance.cache-priority",
606 .voltype = "performance/io-cache",
607 .option = "priority",
608 .op_version = 1,
609 .client_option = _gf_true
610 },
611 { .key = "performance.cache-size",
612 .voltype = "performance/io-cache",
613 .op_version = 1,
614 .client_option = _gf_true
615 },
616
617 /* IO-threads xlator options */
618 { .key = "performance.io-thread-count",
619 .voltype = "performance/io-threads",
620 .option = "thread-count",
621 .op_version = 1
622 },
623 { .key = "performance.high-prio-threads",
624 .voltype = "performance/io-threads",
625 .op_version = 1
626 },
627 { .key = "performance.normal-prio-threads",
628 .voltype = "performance/io-threads",
629 .op_version = 1
630 },
631 { .key = "performance.low-prio-threads",
632 .voltype = "performance/io-threads",
633 .op_version = 1
634 },
635 { .key = "performance.least-prio-threads",
636 .voltype = "performance/io-threads",
637 .op_version = 1
638 },
639 { .key = "performance.enable-least-priority",
640 .voltype = "performance/io-threads",
641 .op_version = 2
642 },
643 { .key = "performance.least-rate-limit",
644 .voltype = "performance/io-threads",
645 .op_version = 1
646 },
647
648 /* Other perf xlators' options */
649 { .key = "performance.cache-size",
650 .voltype = "performance/quick-read",
651 .op_version = 1,
652 .client_option = _gf_true
653 },
654 { .key = "performance.flush-behind",
655 .voltype = "performance/write-behind",
656 .option = "flush-behind",
657 .op_version = 1,
658 .client_option = _gf_true
659 },
660 { .key = "performance.write-behind-window-size",
661 .voltype = "performance/write-behind",
662 .option = "cache-size",
663 .op_version = 1,
664 .client_option = _gf_true
665 },
666 { .key = "performance.strict-o-direct",
667 .voltype = "performance/write-behind",
668 .option = "strict-O_DIRECT",
669 .op_version = 2,
670 .client_option = _gf_true
671 },
672 { .key = "performance.strict-write-ordering",
673 .voltype = "performance/write-behind",
674 .option = "strict-write-ordering",
675 .op_version = 2,
676 .client_option = _gf_true
677 },
678 { .key = "performance.lazy-open",
679 .voltype = "performance/open-behind",
680 .option = "lazy-open",
681 .op_version = 2,
682 .client_option = _gf_true
683 },
684 { .key = "performance.read-ahead-page-count",
685 .voltype = "performance/read-ahead",
686 .option = "page-count",
687 .op_version = 1,
688 .client_option = _gf_true
689 },
690 { .key = "performance.md-cache-timeout",
691 .voltype = "performance/md-cache",
692 .option = "md-cache-timeout",
693 .op_version = 2,
694 .client_option = _gf_true
695 },
696
697 /* Client xlator options */
698 { .key = "network.frame-timeout",
699 .voltype = "protocol/client",
700 .op_version = 1,
701 .client_option = _gf_true
702 },
703 { .key = "network.ping-timeout",
704 .voltype = "protocol/client",
705 .op_version = 1,
706 .client_option = _gf_true
707 },
708 { .key = "network.tcp-window-size",
709 .voltype = "protocol/client",
710 .op_version = 1,
711 .client_option = _gf_true
712 },
713 { .key = "features.lock-heal",
714 .voltype = "protocol/client",
715 .option = "lk-heal",
716 .op_version = 1,
717 .client_option = _gf_true
718 },
719 { .key = "features.grace-timeout",
720 .voltype = "protocol/client",
721 .option = "grace-timeout",
722 .op_version = 1,
723 .client_option = _gf_true
724 },
725 { .key = "client.ssl",
726 .voltype = "protocol/client",
727 .option = "transport.socket.ssl-enabled",
728 .type = NO_DOC,
729 .op_version = 2,
730 .client_option = _gf_true
731 },
732 { .key = "network.remote-dio",
733 .voltype = "protocol/client",
734 .option = "filter-O_DIRECT",
735 .op_version = 1,
736 .client_option = _gf_true
737 },
738
739 /* Server xlator options */
740 { .key = "network.tcp-window-size",
741 .voltype = "protocol/server",
742 .op_version = 1
743 },
744 { .key = "network.inode-lru-limit",
745 .voltype = "protocol/server",
746 .op_version = 1
747 },
748 { .key = AUTH_ALLOW_MAP_KEY"auth.allow",
749 .voltype = "protocol/server",
750 .option = "!server-auth",
751 .value = "*",
752 .op_version = 1
753 },
754 { .key = AUTH_REJECT_MAP_KEY"auth.reject",
755 .voltype = "protocol/server",
756 .option = "!server-auth",
757 .op_version = 1
758 },
759 { .key = "transport.keepalive",
760 .voltype = "protocol/server",
761 .option = "transport.socket.keepalive",
762 .type = NO_DOC,
763 .op_version = 1
764 },
765 { .key = "server.allow-insecure",
766 .voltype = "protocol/server",
767 .option = "rpc-auth-allow-insecure",
768 .type = NO_DOC,
769 .op_version = 1
770 },
771 { .key = "server.root-squash",
772 .voltype = "protocol/server",
773 .option = "root-squash",
774 .op_version = 2
775 },
776 { .key = "server.statedump-path",
777 .voltype = "protocol/server",
778 .option = "statedump-path",
779 .op_version = 1
780 },
781 { .key = "features.lock-heal",
782 .voltype = "protocol/server",
783 .option = "lk-heal",
784 .type = NO_DOC,
785 .op_version = 1
786 },
787 { .key = "features.grace-timeout",
788 .voltype = "protocol/server",
789 .option = "grace-timeout",
790 .type = NO_DOC,
791 .op_version = 1
792 },
793 { .key = "server.ssl",
794 .voltype = "protocol/server",
795 .option = "transport.socket.ssl-enabled",
796 .type = NO_DOC,
797 .op_version = 2
798 },
799
800 /* Performance xlators enable/disbable options */
801 { .key = "performance.write-behind",
802 .voltype = "performance/write-behind",
803 .option = "!perf",
804 .value = "on",
805 .op_version = 1,
806 .description = "enable/disable write-behind translator in the "
807 "volume.",
808 .client_option = _gf_true
809 },
810 { .key = "performance.read-ahead",
811 .voltype = "performance/read-ahead",
812 .option = "!perf",
813 .value = "on",
814 .op_version = 1,
815 .description = "enable/disable read-ahead translator in the "
816 "volume.",
817 .client_option = _gf_true
818 },
819 { .key = "performance.io-cache",
820 .voltype = "performance/io-cache",
821 .option = "!perf",
822 .value = "on",
823 .op_version = 1,
824 .description = "enable/disable io-cache translator in the volume.",
825 .client_option = _gf_true
826 },
827 { .key = "performance.quick-read",
828 .voltype = "performance/quick-read",
829 .option = "!perf",
830 .value = "on",
831 .op_version = 1,
832 .description = "enable/disable quick-read translator in the "
833 "volume.",
834 .client_option = _gf_true
835 },
836 { .key = "performance.open-behind",
837 .voltype = "performance/open-behind",
838 .option = "!perf",
839 .value = "on",
840 .op_version = 2,
841 .description = "enable/disable open-behind translator in the "
842 "volume.",
843 .client_option = _gf_true
844 },
845 { .key = "performance.stat-prefetch",
846 .voltype = "performance/md-cache",
847 .option = "!perf",
848 .value = "on",
849 .op_version = 1,
850 .description = "enable/disable meta-data caching translator in the "
851 "volume.",
852 .client_option = _gf_true
853 },
854 { .key = "performance.client-io-threads",
855 .voltype = "performance/io-threads",
856 .option = "!perf",
857 .value = "off",
858 .op_version = 1,
859 .description = "enable/disable io-threads translator in the client "
860 "graph of volume.",
861 .client_option = _gf_true
862 },
863 { .key = "performance.nfs.write-behind",
864 .voltype = "performance/write-behind",
865 .option = "!nfsperf",
866 .value = "on",
867 .type = NO_DOC,
868 .op_version = 1
869 },
870 { .key = "performance.nfs.read-ahead",
871 .voltype = "performance/read-ahead",
872 .option = "!nfsperf",
873 .value = "off",
874 .type = NO_DOC,
875 .op_version = 1
876 },
877 { .key = "performance.nfs.io-cache",
878 .voltype = "performance/io-cache",
879 .option = "!nfsperf",
880 .value = "off",
881 .type = NO_DOC,
882 .op_version = 1
883 },
884 { .key = "performance.nfs.quick-read",
885 .voltype = "performance/quick-read",
886 .option = "!nfsperf",
887 .value = "off",
888 .type = NO_DOC,
889 .op_version = 1
890 },
891 { .key = "performance.nfs.stat-prefetch",
892 .voltype = "performance/md-cache",
893 .option = "!nfsperf",
894 .value = "off",
895 .type = NO_DOC,
896 .op_version = 1
897 },
898 { .key = "performance.nfs.io-threads",
899 .voltype = "performance/io-threads",
900 .option = "!nfsperf",
901 .value = "off",
902 .type = NO_DOC,
903 .op_version = 1
904 },
905 { .key = "performance.force-readdirp",
906 .voltype = "performance/md-cache",
907 .option = "force-readdirp",
908 .op_version = 2,
909 .client_option = _gf_true
910 },
911
912 /* Quota xlator options */
913 { .key = VKEY_FEATURES_LIMIT_USAGE"features.limit-usage",
914 .voltype = "features/quota",
915 .option = "limit-set",
916 .type = NO_DOC,
917 .op_version = 1,
918 .client_option = _gf_true
919 },
920 { .key = "features.quota-timeout",
921 .voltype = "features/quota",
922 .option = "timeout",
923 .value = "0",
924 .op_version = 1,
925 .validate_fn = validate_quota,
926 .client_option = _gf_true
927 },
928 { .key = "features.quota-deem-statfs",
929 .voltype = "features/quota",
930 .option = "deem-statfs",
931 .value = "off",
932 .type = DOC,
933 .op_version = 2,
934 .validate_fn = validate_quota,
935 .client_option = _gf_true
936 },
937
938 /* Marker xlator options */
939 { .key = VKEY_MARKER_XTIME"geo-replication"".indexing",
940 .voltype = "features/marker",
941 .option = "xtime",
942 .value = "off",
943 .type = NO_DOC,
944 .flags = OPT_FLAG_FORCE,
945 .op_version = 1
946 },
947 { .key = VKEY_MARKER_XTIME"geo-replication"".indexing",
948 .voltype = "features/marker",
949 .option = "!xtime",
950 .value = "off",
951 .type = NO_DOC,
952 .flags = OPT_FLAG_FORCE,
953 .op_version = 1
954 },
955 { .key = VKEY_FEATURES_QUOTA"features.quota",
956 .voltype = "features/marker",
957 .option = "quota",
958 .value = "off",
959 .type = NO_DOC,
960 .flags = OPT_FLAG_FORCE,
961 .op_version = 1
962 },
963
964 /* Debug xlators options */
965 { .key = "debug.trace",
966 .voltype = "debug/trace",
967 .option = "!debug",
968 .value = "off",
969 .type = NO_DOC,
970 .op_version = 1
971 },
972 { .key = "debug.log-history",
973 .voltype = "debug/trace",
974 .option = "log-history",
975 .type = NO_DOC,
976 .op_version = 2
977 },
978 { .key = "debug.log-file",
979 .voltype = "debug/trace",
980 .option = "log-file",
981 .type = NO_DOC,
982 .op_version = 2
983 },
984 { .key = "debug.exclude-ops",
985 .voltype = "debug/trace",
986 .option = "exclude-ops",
987 .type = NO_DOC,
988 .op_version = 2
989 },
990 { .key = "debug.include-ops",
991 .voltype = "debug/trace",
992 .option = "include-ops",
993 .type = NO_DOC,
994 .op_version = 2
995 },
996 { .key = "debug.error-gen",
997 .voltype = "debug/error-gen",
998 .option = "!debug",
999 .value = "off",
1000 .type = NO_DOC,
1001 .op_version = 1
1002 },
1003 { .key = "debug.error-failure",
1004 .voltype = "debug/error-gen",
1005 .option = "failure",
1006 .type = NO_DOC,
1007 .op_version = 2
1008 },
1009 { .key = "debug.error-number",
1010 .voltype = "debug/error-gen",
1011 .option = "error-no",
1012 .type = NO_DOC,
1013 .op_version = 2
1014 },
1015 { .key = "debug.random-failure",
1016 .voltype = "debug/error-gen",
1017 .option = "random-failure",
1018 .type = NO_DOC,
1019 .op_version = 2
1020 },
1021 { .key = "debug.error-fops",
1022 .voltype = "debug/error-gen",
1023 .option = "enable",
1024 .type = NO_DOC,
1025 .op_version = 2
1026 },
1027
1028
1029 /* NFS xlator options */
1030 { .key = "nfs.enable-ino32",
1031 .voltype = "nfs/server",
1032 .option = "nfs.enable-ino32",
1033 .type = GLOBAL_DOC,
1034 .op_version = 1
1035 },
1036 { .key = "nfs.mem-factor",
1037 .voltype = "nfs/server",
1038 .option = "nfs.mem-factor",
1039 .type = GLOBAL_DOC,
1040 .op_version = 1
1041 },
1042 { .key = "nfs.export-dirs",
1043 .voltype = "nfs/server",
1044 .option = "nfs3.export-dirs",
1045 .type = GLOBAL_DOC,
1046 .op_version = 1
1047 },
1048 { .key = "nfs.export-volumes",
1049 .voltype = "nfs/server",
1050 .option = "nfs3.export-volumes",
1051 .type = GLOBAL_DOC,
1052 .op_version = 1
1053 },
1054 { .key = "nfs.addr-namelookup",
1055 .voltype = "nfs/server",
1056 .option = "rpc-auth.addr.namelookup",
1057 .type = GLOBAL_DOC,
1058 .op_version = 1
1059 },
1060 { .key = "nfs.dynamic-volumes",
1061 .voltype = "nfs/server",
1062 .option = "nfs.dynamic-volumes",
1063 .type = GLOBAL_DOC,
1064 .op_version = 1
1065 },
1066 { .key = "nfs.register-with-portmap",
1067 .voltype = "nfs/server",
1068 .option = "rpc.register-with-portmap",
1069 .type = GLOBAL_DOC,
1070 .op_version = 1
1071 },
1072 { .key = "nfs.port",
1073 .voltype = "nfs/server",
1074 .option = "nfs.port",
1075 .type = GLOBAL_DOC,
1076 .op_version = 1
1077 },
1078 { .key = "nfs.rpc-auth-unix",
1079 .voltype = "nfs/server",
1080 .option = "!rpc-auth.auth-unix.*",
1081 .op_version = 1
1082 },
1083 { .key = "nfs.rpc-auth-null",
1084 .voltype = "nfs/server",
1085 .option = "!rpc-auth.auth-null.*",
1086 .op_version = 1
1087 },
1088 { .key = "nfs.rpc-auth-allow",
1089 .voltype = "nfs/server",
1090 .option = "!rpc-auth.addr.*.allow",
1091 .op_version = 1
1092 },
1093 { .key = "nfs.rpc-auth-reject",
1094 .voltype = "nfs/server",
1095 .option = "!rpc-auth.addr.*.reject",
1096 .op_version = 1
1097 },
1098 { .key = "nfs.ports-insecure",
1099 .voltype = "nfs/server",
1100 .option = "!rpc-auth.ports.*.insecure",
1101 .op_version = 1
1102 },
1103 { .key = "nfs.transport-type",
1104 .voltype = "nfs/server",
1105 .option = "!nfs.transport-type",
1106 .value = "tcp",
1107 .op_version = 1,
1108 .description = "Specifies the nfs transport type. Valid "
1109 "transport types are 'tcp' and 'rdma'."
1110 },
1111 { .key = "nfs.trusted-sync",
1112 .voltype = "nfs/server",
1113 .option = "!nfs3.*.trusted-sync",
1114 .op_version = 1
1115 },
1116 { .key = "nfs.trusted-write",
1117 .voltype = "nfs/server",
1118 .option = "!nfs3.*.trusted-write",
1119 .op_version = 1
1120 },
1121 { .key = "nfs.volume-access",
1122 .voltype = "nfs/server",
1123 .option = "!nfs3.*.volume-access",
1124 .op_version = 1
1125 },
1126 { .key = "nfs.export-dir",
1127 .voltype = "nfs/server",
1128 .option = "!nfs3.*.export-dir",
1129 .op_version = 1
1130 },
1131 { .key = NFS_DISABLE_MAP_KEY"nfs.disable",
1132 .voltype = "nfs/server",
1133 .option = "!nfs-disable",
1134 .op_version = 1
1135 },
1136 { .key = "nfs.nlm",
1137 .voltype = "nfs/server",
1138 .option = "nfs.nlm",
1139 .type = GLOBAL_DOC,
1140 .op_version = 1
1141 },
1142 { .key = "nfs.mount-udp",
1143 .voltype = "nfs/server",
1144 .option = "nfs.mount-udp",
1145 .type = GLOBAL_DOC,
1146 .op_version = 1
1147 },
1148 { .key = "nfs.server-aux-gids",
1149 .voltype = "nfs/server",
1150 .option = "nfs.server-aux-gids",
1151 .type = NO_DOC,
1152 .op_version = 2
1153 },
1154
1155 /* Other options which don't fit any place above */
1156 { .key = "features.read-only",
1157 .voltype = "features/read-only",
1158 .option = "!read-only",
1159 .value = "off",
1160 .op_version = 2,
1161 .client_option = _gf_true
1162 },
1163 { .key = "features.worm",
1164 .voltype = "features/worm",
1165 .option = "!worm",
1166 .value = "off",
1167 .op_version = 2,
1168 .client_option = _gf_true
1169 },
1170 { .key = "storage.linux-aio",
1171 .voltype = "storage/posix",
1172 .op_version = 2
1173 },
1174 { .key = "storage.owner-uid",
1175 .voltype = "storage/posix",
1176 .option = "brick-uid",
1177 .op_version = 2
1178 },
1179 { .key = "storage.owner-gid",
1180 .voltype = "storage/posix",
1181 .option = "brick-gid",
1182 .op_version = 2
1183 },
1184 { .key = "storage.node-uuid-pathinfo",
1185 .voltype = "storage/posix",
1186 .op_version = 2
1187 },
1188 { .key = "config.memory-accounting",
1189 .voltype = "configuration",
1190 .option = "!config",
1191 .op_version = 2,
1192 .client_option = _gf_true
1193 },
1194 { .key = "config.transport",
1195 .voltype = "configuration",
1196 .option = "!config",
1197 .op_version = 2
1198 },
1199 { .key = GLUSTERD_QUORUM_TYPE_KEY"cluster.server-quorum-type",
1200 .voltype = "mgmt/glusterd",
1201 .value = "off",
1202 .op_version = 2
1203 },
1204 { .key = GLUSTERD_QUORUM_RATIO_KEY"cluster.server-quorum-ratio",
1205 .voltype = "mgmt/glusterd",
1206 .value = "0",
1207 .op_version = 2
1208 },
1209 { .key = NULL((void*)0)
1210 }
1211};