Patchwork [BUG:1873] mgmt/glusterd: Unlock upon a cli request failure

login
register
Submitter Vijay Bellur
Date 2010-10-27 08:37:29
Message ID <20101027083729.GA28119@dev.gluster.com>
Download mbox | patch
Permalink /patch/5579/
State Accepted
Headers show

Comments

Vijay Bellur - 2010-10-27 08:37:29
Signed-off-by: Vijay Bellur <vijay@gluster.com>
---
 xlators/mgmt/glusterd/src/glusterd-handler.c |   14 +++++++-------
 xlators/mgmt/glusterd/src/glusterd3_1-mops.c |    4 ++++
 2 files changed, 11 insertions(+), 7 deletions(-)

Patch

diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 9ef81a4..f331e34 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -1092,8 +1092,8 @@  glusterd_handle_add_brick (rpcsvc_request_t *req)
                 if (!brick_count || !volinfo->sub_count)
                         goto brick_val;
 
-		/* If the brick count is less than sub_count then, allow add-brick only for 
-		   plain replicate volume since in plain stripe brick_count becoming less than 
+		/* If the brick count is less than sub_count then, allow add-brick only for
+		   plain replicate volume since in plain stripe brick_count becoming less than
 		   the sub_count is not allowed */
                 if (volinfo->brick_count < volinfo->sub_count && (volinfo->type == GF_CLUSTER_TYPE_REPLICATE) ) {
                         if ((volinfo->sub_count - volinfo->brick_count) == brick_count)
@@ -2879,7 +2879,7 @@  out:
                 rsp.op_ret = 1;
         else
                 rsp.op_ret = ret;
-        if (!rsp.volname) 
+        if (!rsp.volname)
                 rsp.volname = "";
         if (!rsp.op_errstr)
                 rsp.op_errstr = "Error, Validation failed";
@@ -2897,7 +2897,7 @@  glusterd_reset_volume (rpcsvc_request_t *req, dict_t *dict)
 {
         int ret = -1;
 
-        
+
         glusterd_op_set_op (GD_OP_RESET_VOLUME);
 
         glusterd_op_set_ctx (GD_OP_RESET_VOLUME, dict);
@@ -2909,7 +2909,7 @@  glusterd_reset_volume (rpcsvc_request_t *req, dict_t *dict)
         glusterd_op_set_req (req);
 
         ret = glusterd_op_txn_begin ();
-        
+
         return ret;
 }
 
@@ -2923,11 +2923,11 @@  glusterd_set_volume (rpcsvc_request_t *req, dict_t *dict)
 
         GF_ASSERT (req);
         GF_ASSERT (dict);
-        
+
         ret = dict_get_int32 (dict, "count", &dict_count);
         if (ret)
                goto out;
-        
+
         if (dict_count == 1) {
                 if (dict_get (dict, "history")) {
                         ret = glusterd_set_volume_history(req, dict);
diff --git a/xlators/mgmt/glusterd/src/glusterd3_1-mops.c b/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
index b8abebf..8e9c080 100644
--- a/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
+++ b/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
@@ -1357,6 +1357,7 @@  glusterd_handle_rpc_msg (rpcsvc_request_t *req)
         int             ret = -1;
         gf_boolean_t    is_cli_req = _gf_false;
         char            *op_errstr = NULL;
+        int             lock_fail = 0;
 
         GF_ASSERT (req);
 
@@ -1368,6 +1369,7 @@  glusterd_handle_rpc_msg (rpcsvc_request_t *req)
                 if (ret) {
                         gf_log ("", GF_LOG_ERROR, "Unable to set cli op: %d",
                                 ret);
+                        lock_fail = 1;
                         goto out;
                 }
         }
@@ -1496,6 +1498,8 @@  out:
                    be 0, and we should not point to any RPC errors, because
                    otherwise rpcsvc.c will send an error reply for the same
                    request, which causes double replies */
+                if (!lock_fail)
+                        (void) glusterd_opinfo_unlock ();
                 ret = glusterd_op_send_cli_response (req->procnum, ret, 0, req, NULL, op_errstr);
         }
         if (op_errstr && (strcmp (op_errstr, "")))