summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c74
1 files changed, 23 insertions, 51 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
index 5077a0092..27d40b3a7 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c
@@ -30,9 +30,12 @@ static int
glusterd_mgmt_v3_lock_send_resp (rpcsvc_request_t *req, int32_t status)
{
- gd1_mgmt_v3_lock_rsp rsp = {{0},};
- int ret = -1;
+ gd1_mgmt_v3_lock_rsp rsp = {{0},};
+ int ret = -1;
+ xlator_t *this = NULL;
+ this = THIS;
+ GF_ASSERT (this);
GF_ASSERT (req);
rsp.op_ret = status;
@@ -44,7 +47,7 @@ glusterd_mgmt_v3_lock_send_resp (rpcsvc_request_t *req, int32_t status)
ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gd1_mgmt_v3_lock_rsp);
- gf_log (THIS->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_DEBUG,
"Responded to mgmt_v3 lock, ret: %d", ret);
return ret;
@@ -56,9 +59,7 @@ glusterd_synctasked_mgmt_v3_lock (rpcsvc_request_t *req,
glusterd_op_lock_ctx_t *ctx)
{
int32_t ret = -1;
- int32_t volcount = -1;
xlator_t *this = NULL;
- char *volname = NULL;
this = THIS;
GF_ASSERT (this);
@@ -66,29 +67,13 @@ glusterd_synctasked_mgmt_v3_lock (rpcsvc_request_t *req,
GF_ASSERT (ctx);
GF_ASSERT (ctx->dict);
- ret = dict_get_int32 (ctx->dict, "volcount", &volcount);
- if (ret) {
- ret = dict_get_str (ctx->dict, "volname", &volname);
- if (ret) {
- gf_log ("", GF_LOG_ERROR,
- "Failed to get volname");
- goto out;
- }
- ret = glusterd_mgmt_v3_lock (volname, ctx->uuid, "vol");
-
- if (ret)
- gf_log (this->name, GF_LOG_ERROR,
- "Unable to acquire local lock for %s", volname);
- } else {
- /* Trying to acquire multiple mgmt_v3 locks */
- ret = glusterd_multiple_mgmt_v3_lock (ctx->dict, ctx->uuid);
- if (ret)
- gf_log ("", GF_LOG_ERROR,
- "Failed to acquire mgmt_v3 locks for %s",
- uuid_utoa (ctx->uuid));
- }
+ /* Trying to acquire multiple mgmt_v3 locks */
+ ret = glusterd_multiple_mgmt_v3_lock (ctx->dict, ctx->uuid);
+ if (ret)
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to acquire mgmt_v3 locks for %s",
+ uuid_utoa (ctx->uuid));
-out:
ret = glusterd_mgmt_v3_lock_send_resp (req, ret);
gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
@@ -712,9 +697,12 @@ static int
glusterd_mgmt_v3_unlock_send_resp (rpcsvc_request_t *req, int32_t status)
{
- gd1_mgmt_v3_unlock_rsp rsp = {{0},};
- int ret = -1;
+ gd1_mgmt_v3_unlock_rsp rsp = {{0},};
+ int ret = -1;
+ xlator_t *this = NULL;
+ this = THIS;
+ GF_ASSERT (this);
GF_ASSERT (req);
rsp.op_ret = status;
@@ -726,7 +714,7 @@ glusterd_mgmt_v3_unlock_send_resp (rpcsvc_request_t *req, int32_t status)
ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gd1_mgmt_v3_unlock_rsp);
- gf_log (THIS->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_DEBUG,
"Responded to mgmt_v3 unlock, ret: %d", ret);
return ret;
@@ -738,37 +726,21 @@ glusterd_synctasked_mgmt_v3_unlock (rpcsvc_request_t *req,
glusterd_op_lock_ctx_t *ctx)
{
int32_t ret = -1;
- int32_t volcount = -1;
xlator_t *this = NULL;
- char *volname = NULL;
this = THIS;
GF_ASSERT (this);
GF_ASSERT (req);
GF_ASSERT (ctx);
- ret = dict_get_int32 (ctx->dict, "volcount", &volcount);
+ /* Trying to release multiple mgmt_v3 locks */
+ ret = glusterd_multiple_mgmt_v3_unlock (ctx->dict, ctx->uuid);
if (ret) {
- ret = dict_get_str (ctx->dict, "volname", &volname);
- if (ret) {
- gf_log ("", GF_LOG_ERROR,
- "Failed to get volname");
- goto out;
- }
- ret = glusterd_mgmt_v3_unlock (volname, ctx->uuid, "vol");
- if (ret)
- gf_log (this->name, GF_LOG_ERROR,
- "Unable to release lock for %s", volname);
- } else {
- /* Trying to release multiple mgmt_v3 locks */
- ret = glusterd_multiple_mgmt_v3_unlock (ctx->dict, ctx->uuid);
- if (ret)
- gf_log ("", GF_LOG_ERROR,
- "Failed to release mgmt_v3 locks for %s",
- uuid_utoa(ctx->uuid));
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to release mgmt_v3 locks for %s",
+ uuid_utoa(ctx->uuid));
}
-out:
ret = glusterd_mgmt_v3_unlock_send_resp (req, ret);
gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);