From a9797607a968a4d54d1f28f44048ec5925721098 Mon Sep 17 00:00:00 2001 From: Joseph Fernandes Date: Tue, 24 Jun 2014 14:19:29 +0530 Subject: glusterd/snapshot: Fixed errmsg and Quorum check in Snapshot Operation 1) Removing the static message "unbarrier brick opfailed" and log errors / message in places. 2) Calling the Snapshot Volume Quorum check if the commit is passed, as the check(which checks the sanity of glusterds or snapvolume) a successful commit makes more sense. Change-Id: I7b8f77aa9b2e553893a6ae71bd4b5bbbb60ab8f1 BUG: 1112559 Signed-off-by: Joseph Fernandes Reviewed-on: http://review.gluster.org/8158 Tested-by: Gluster Build System Reviewed-by: Atin Mukherjee Reviewed-by: Avra Sengupta Reviewed-by: Krishnan Parthasarathi Tested-by: Krishnan Parthasarathi --- xlators/mgmt/glusterd/src/glusterd-mgmt.c | 37 ++++++++++++++++--------------- 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c index dab1e691ce3..e93afb27dab 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c +++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c @@ -1765,7 +1765,7 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op, gf_boolean_t is_acquired = _gf_false; uuid_t *originator_uuid = NULL; gf_boolean_t success = _gf_false; - char *tmp_errstr = NULL; + char *cli_errstr = NULL; this = THIS; GF_ASSERT (this); @@ -1843,7 +1843,8 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op, /* quorum check of the volume is done here */ ret = glusterd_snap_quorum_check (req_dict, _gf_false, &op_errstr); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "quorum check failed"); + gf_log (this->name, GF_LOG_WARNING, + "Volume quorum check failed"); goto out; } @@ -1897,7 +1898,7 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op, unlock ops also. We might lose the actual error that caused the failure. */ - tmp_errstr = op_errstr; + cli_errstr = op_errstr; op_errstr = NULL; goto unbarrier; } @@ -1922,11 +1923,15 @@ unbarrier: goto out; } - // quorum check of the snapshot volume - ret = glusterd_snap_quorum_check (dict, _gf_true, &op_errstr); - if (ret) { - gf_log (this->name, GF_LOG_WARNING, "quorum check failed"); - goto out; + /*Do a quorum check if the commit phase is successful*/ + if (success) { + //quorum check of the snapshot volume + ret = glusterd_snap_quorum_check (dict, _gf_true, &op_errstr); + if (ret) { + gf_log (this->name, GF_LOG_WARNING, + "Snapshot Volume quorum check failed"); + goto out; + } } ret = 0; @@ -1951,19 +1956,15 @@ out: npeers, is_acquired); /* If the commit op (snapshot taking) failed, then the error is stored - in tmp_errstr and unbarrier is called. Suppose, if unbarrier also + in cli_errstr and unbarrier is called. Suppose, if unbarrier also fails, then the error happened in unbarrier is logged and freed. - The error happened in commit op, which is stored in tmp_errstr + The error happened in commit op, which is stored in cli_errstr is sent to cli. */ - if (tmp_errstr) { - if (op_errstr) { - gf_log (this->name, GF_LOG_ERROR, "unbarrier brick op" - "failed with the error %s", op_errstr); - GF_FREE (op_errstr); - op_errstr = NULL; - } - op_errstr = tmp_errstr; + if (cli_errstr) { + GF_FREE (op_errstr); + op_errstr = NULL; + op_errstr = cli_errstr; } /* LOCAL VOLUME(S) UNLOCK */ -- cgit