summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
authorMeghana Madhusudhan <mmadhusu@redhat.com>2015-04-20 10:41:47 +0530
committerKaleb KEITHLEY <kkeithle@redhat.com>2015-05-06 05:33:40 -0700
commit403a74da5d3287489829c629d42643b8b320ee62 (patch)
tree1e4a83647dee5a1fd72a496804375e1c6554aa81 /xlators/mgmt/glusterd/src/glusterd-op-sm.c
parent96871c7ddc39cdb502ebfb6d975fe8859fc3e0e9 (diff)
NFS-Ganesha : Locking global options file
Global option gluster features.ganesha enable writes into the global 'option' file. The snapshot feature also writes into the same file. To handle concurrent multiple transactions correctly, a new lock has to be introduced on this file. Every operation using this file needs to contest for the new lock type. Change-Id: Ia8a324d2a466717b39f2700599edd9f345b939a9 BUG: 1200254 Signed-off-by: Meghana Madhusudhan <mmadhusu@redhat.com> Reviewed-on: http://review.gluster.org/10130 Reviewed-by: Avra Sengupta <asengupt@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: soumya k <skoduri@redhat.com> Tested-by: NetBSD Build System Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 73f71196789..dfb3a2666d7 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -3232,7 +3232,9 @@ static int
glusterd_op_ac_lock (glusterd_op_sm_event_t *event, void *ctx)
{
int32_t ret = 0;
+ int32_t err = 0;
char *volname = NULL;
+ char *globalname = NULL;
glusterd_op_lock_ctx_t *lock_ctx = NULL;
glusterd_conf_t *priv = NULL;
xlator_t *this = NULL;
@@ -3263,8 +3265,19 @@ glusterd_op_ac_lock (glusterd_op_sm_event_t *event, void *ctx)
gf_log (this->name, GF_LOG_ERROR,
"Unable to acquire lock for %s",
volname);
+ goto out;
}
+ ret = dict_get_str (lock_ctx->dict, "globalname", &globalname);
+ if (!ret) {
+ ret = glusterd_mgmt_v3_lock (globalname, lock_ctx->uuid,
+ "global");
+ if (ret)
+ gf_log (this->name, GF_LOG_ERROR,
+ "Unable to acquire lock for %s",
+ globalname);
+ }
+out:
glusterd_op_mgmt_v3_lock_send_resp (lock_ctx->req,
&event->txn_id, ret);
@@ -3280,6 +3293,7 @@ glusterd_op_ac_unlock (glusterd_op_sm_event_t *event, void *ctx)
{
int32_t ret = 0;
char *volname = NULL;
+ char *globalname = NULL;
glusterd_op_lock_ctx_t *lock_ctx = NULL;
glusterd_conf_t *priv = NULL;
xlator_t *this = NULL;
@@ -3311,8 +3325,20 @@ glusterd_op_ac_unlock (glusterd_op_sm_event_t *event, void *ctx)
gf_log (this->name, GF_LOG_ERROR,
"Unable to release lock for %s",
volname);
+ goto out;
}
+ ret = dict_get_str (lock_ctx->dict, "globalname", &globalname);
+ if (!ret) {
+ ret = glusterd_mgmt_v3_unlock (globalname, lock_ctx->uuid,
+ "global");
+ if (ret)
+ gf_log (this->name, GF_LOG_ERROR,
+ "Unable to release lock for %s",
+ globalname);
+
+ }
+out:
glusterd_op_mgmt_v3_unlock_send_resp (lock_ctx->req,
&event->txn_id, ret);