diff options
author | Anoop C S <anoopcs@redhat.com> | 2015-02-04 10:34:33 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2016-05-02 04:18:44 -0700 |
commit | 4517bf8dd6de310950cc5a612955aa3a2fddb57e (patch) | |
tree | 2cdf4e8ec5c9362a325d5a48e07778ea44e1fdfe /xlators/mgmt | |
parent | 78c1c6002f0b11afa997a14f8378c04f257ea1c5 (diff) |
features/locks: Implement mandatory locks
Initial change to fix/enable the mandatory locking support in GlusterFS
as per the following design:
https://review.gluster.org/#/c/12014/
Accordingly 'locks.mandatory-locking' option is available as part of this
change which will accept one among the following values:
* off
* file
* forced
* optimal
See design doc for more details
Change-Id: I14c489b3f8af5ebcbfa155a03f0c175e9558ac46
BUG: 762184
Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-on: http://review.gluster.org/9768
Smoke: Gluster Build System <jenkins@build.gluster.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Poornima G <pgurusid@redhat.com>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-set.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c index 68dec22ecaf..008a4589e10 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c @@ -791,6 +791,35 @@ validate_replica_heal_enable_disable (glusterd_volinfo_t *volinfo, dict_t *dict, } static int +validate_mandatory_locking (glusterd_volinfo_t *volinfo, dict_t *dict, + char *key, char *value, char **op_errstr) +{ + char errstr[2048] = ""; + int ret = 0; + xlator_t *this = NULL; + + this = THIS; + GF_ASSERT (this); + + if (strcmp (value, "off") != 0 && strcmp (value, "file") != 0 && + strcmp(value, "forced") != 0 && + strcmp(value, "optimal") != 0) { + snprintf (errstr, sizeof(errstr), "Invalid option value '%s':" + " Available options are 'off', 'file', " + "'forced' or 'optimal'", value); + gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_INVALID_ENTRY, + "%s", errstr); + *op_errstr = gf_strdup (errstr); + ret = -1; + goto out; + } +out: + gf_msg_debug (this->name, 0, "Returning %d", ret); + + return ret; +} + +static int validate_disperse_heal_enable_disable (glusterd_volinfo_t *volinfo, dict_t *dict, char *key, char *value, char **op_errstr) @@ -2789,9 +2818,13 @@ struct volopt_map_entry glusterd_volopt_map[] = { #endif /* USE_GFDB */ { .key = "locks.trace", .voltype = "features/locks", - .type = NO_DOC, .op_version = GD_OP_VERSION_3_7_0, }, + { .key = "locks.mandatory-locking", + .voltype = "features/locks", + .op_version = GD_OP_VERSION_4_0_0, + .validate_fn = validate_mandatory_locking, + }, { .key = "cluster.disperse-self-heal-daemon", .voltype = "cluster/disperse", .type = NO_DOC, |