summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorAnoop C S <anoopcs@redhat.com>2015-02-04 10:34:33 +0530
committerNiels de Vos <ndevos@redhat.com>2016-05-03 02:24:58 -0700
commitf5e52561d66f3777e4ec75992e52200779d9add1 (patch)
treeea49242dd3c1fa1a25eb40dc187c6b5a8b5bc3f3 /xlators/mgmt
parent0fadd46c2cdf692efa3040d8ba42f3fdaca599b1 (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 > 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> (cherry picked from commit 4517bf8dd6de310950cc5a612955aa3a2fddb57e) Change-Id: I14c489b3f8af5ebcbfa155a03f0c175e9558ac46 BUG: 1332162 Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-on: http://review.gluster.org/14149 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c35
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,