diff options
author | Meghana Madhusudhan <mmadhusu@redhat.com> | 2015-04-20 10:41:47 +0530 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2015-05-07 02:08:43 -0700 |
commit | 4aad69a8f88acf384c812316aaa985cde2229cd7 (patch) | |
tree | 12318360918c95e89f7a40a24855e626cae0a014 /xlators/mgmt/glusterd/src/glusterd-op-sm.c | |
parent | 6d82215ab95d95ace13465a3efd384e50942ea67 (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.
This is a back-port of the patch,
http://review.gluster.org/#/c/10130/
Change-Id: I1fdd285814e615a13dbf8c88ad2b7ee311247f90
BUG: 1218963
Signed-off-by: Meghana Madhusudhan <mmadhusu@redhat.com>
Reviewed-on: http://review.gluster.org/10606
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: NetBSD Build System
Reviewed-by: Avra Sengupta <asengupt@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 26 |
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 da922e3d674..cb8080693c6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -3162,7 +3162,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; @@ -3193,8 +3195,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); @@ -3210,6 +3223,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; @@ -3241,8 +3255,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); |