summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2013-09-20 11:37:51 +0530
committerAnand Avati <avati@redhat.com>2013-09-29 17:01:57 -0700
commitf84c710e93ab48dceabd3824f5286ed3edd9b60d (patch)
tree147256e4d447fd8002b3f33d891c9f132d8dd388
parent8bd16cc88527584e91baa8773b4f01e7c44708c1 (diff)
glusterd: Set errstr appropriately on peer op failure
Change-Id: I27f5f7cd54115d7b236b42f6beaaa05a8b379dd7 BUG: 1010153 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/5978 Reviewed-by: Harshavardhana <harsha@harshavardhana.net> Reviewed-by: Amar Tumballi <amarts@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index afc2236..93c6959 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -3059,9 +3059,13 @@ glusterd_xfer_friend_add_resp (rpcsvc_request_t *req, char *myhostname,
}
static void
-get_probe_error_str (int op_ret, int op_errno, char *errstr, size_t len,
- char *hostname, int port)
+set_probe_error_str (int op_ret, int op_errno, char *op_errstr, char *errstr,
+ size_t len, char *hostname, int port)
{
+ if ((op_errstr) && (strcmp (op_errstr, ""))) {
+ snprintf (errstr, len, "%s", op_errstr);
+ return;
+ }
if (!op_ret) {
switch (op_errno) {
@@ -3141,11 +3145,8 @@ glusterd_xfer_cli_probe_resp (rpcsvc_request_t *req, int32_t op_ret,
GF_ASSERT (req);
GF_ASSERT (this);
- if (op_errstr == NULL)
- (void) get_probe_error_str (op_ret, op_errno, errstr,
- sizeof (errstr), hostname, port);
- else
- snprintf (errstr, sizeof (errstr), "%s", op_errstr);
+ (void) set_probe_error_str (op_ret, op_errno, op_errstr, errstr,
+ sizeof (errstr), hostname, port);
if (dict) {
ret = dict_get_str (dict, "cmd-str", &cmd_str);
@@ -3174,9 +3175,14 @@ glusterd_xfer_cli_probe_resp (rpcsvc_request_t *req, int32_t op_ret,
}
static void
-get_deprobe_error_str (int op_ret, int op_errno, char *errstr, size_t len,
- char *hostname)
+set_deprobe_error_str (int op_ret, int op_errno, char *op_errstr, char *errstr,
+ size_t len, char *hostname)
{
+ if ((op_errstr) && (strcmp (op_errstr, ""))) {
+ snprintf (errstr, len, "%s", op_errstr);
+ return;
+ }
+
if (op_ret) {
switch (op_errno) {
case GF_DEPROBE_LOCALHOST:
@@ -3228,8 +3234,8 @@ glusterd_xfer_cli_deprobe_resp (rpcsvc_request_t *req, int32_t op_ret,
GF_ASSERT (req);
- (void) get_deprobe_error_str (op_ret, op_errno, errstr, sizeof (errstr),
- hostname);
+ (void) set_deprobe_error_str (op_ret, op_errno, op_errstr, errstr,
+ sizeof (errstr), hostname);
if (dict) {
ret = dict_get_str (dict, "cmd-str", &cmd_str);