Blob Blame History Raw
From 1cc0f90c9384500419791bf6b235ff6960255a8a Mon Sep 17 00:00:00 2001
From: "Kaleb S. KEITHLEY" <kkeithle@redhat.com>
Date: Tue, 13 Sep 2016 05:57:32 -0400
Subject: [PATCH 246/246] protocol/client: fix op_errno handling, was unused
 variable

        Backport of: http://review.gluster.org/15482

see comment in patch set one. Match the general logic flow of the
other fop-cbks and eliminate the unused variable and its associated
warning

also see comment in patch set seven, re: correct handling of
client_process_response(); and the associated BZ
https://bugzilla.redhat.com/show_bug.cgi?id=1376328

http://review.gluster.org/14085 fixes a "pragma leak" where the
generated rpc/xdr headers have a pair of pragmas that disable these
warnings. With the warnings disabled, many unused variables have
crept into the code base.

And 14085 won't pass its own smoke test until all these warnings are
fixed.

Change-Id: I52f63e563f7ce827a5e00fd5af3e46182f1483e2
BUG: 1405299
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/93157
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: Atin Mukherjee <amukherj@redhat.com>
---
 xlators/protocol/client/src/client-rpc-fops.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c
index c2dadac..e289086 100644
--- a/xlators/protocol/client/src/client-rpc-fops.c
+++ b/xlators/protocol/client/src/client-rpc-fops.c
@@ -3165,7 +3165,6 @@ client3_3_compound_cbk (struct rpc_req *req, struct iovec *iov, int count,
         xlator_t                *this            = NULL;
         dict_t                  *xdata           = NULL;
         clnt_local_t            *local           = NULL;
-        int                     op_errno         = 0;
         int                     i                = 0;
         int                     length           = 0;
         int                     ret              = -1;
@@ -3176,7 +3175,8 @@ client3_3_compound_cbk (struct rpc_req *req, struct iovec *iov, int count,
         local = frame->local;
 
         if (-1 == req->rpc_status) {
-                op_errno = ENOTCONN;
+                rsp.op_ret   = -1;
+                rsp.op_errno = ENOTCONN;
                 goto out;
         }
 
@@ -3184,7 +3184,8 @@ client3_3_compound_cbk (struct rpc_req *req, struct iovec *iov, int count,
         if (ret < 0) {
                 gf_msg (this->name, GF_LOG_ERROR, EINVAL,
                         PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
-                op_errno = EINVAL;
+                rsp.op_ret   = -1;
+                rsp.op_errno = EINVAL;
                 goto out;
         }
 
@@ -3196,21 +3197,30 @@ client3_3_compound_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         args_cbk = compound_args_cbk_alloc (length, xdata);
         if (!args_cbk) {
-                op_errno = ENOMEM;
+                rsp.op_ret = -1;
+                rsp.op_errno = ENOMEM;
                 goto out;
         }
 
+        /* TODO: see https://bugzilla.redhat.com/show_bug.cgi?id=1376328 */
         for (i = 0; i < args_cbk->fop_length; i++) {
                 ret = client_process_response (frame, this, req, &rsp,
                                                args_cbk, i);
                 if (ret) {
-                        op_errno = -ret;
+                        rsp.op_ret = -1;
+                        rsp.op_errno = -ret;
                         goto out;
                 }
 
         }
         rsp.op_ret = 0;
 out:
+        if (rsp.op_ret == -1) {
+                gf_msg (this->name, GF_LOG_WARNING,
+                        gf_error_to_errno (rsp.op_errno),
+                        PC_MSG_REMOTE_OP_FAILED,
+                        "remote operation failed");
+        }
         CLIENT_STACK_UNWIND (compound, frame, rsp.op_ret,
                              gf_error_to_errno (rsp.op_errno), args_cbk, xdata);
 
-- 
2.9.3