3604df
From 1cc0f90c9384500419791bf6b235ff6960255a8a Mon Sep 17 00:00:00 2001
3604df
From: "Kaleb S. KEITHLEY" <kkeithle@redhat.com>
3604df
Date: Tue, 13 Sep 2016 05:57:32 -0400
3604df
Subject: [PATCH 246/246] protocol/client: fix op_errno handling, was unused
3604df
 variable
3604df
3604df
        Backport of: http://review.gluster.org/15482
3604df
3604df
see comment in patch set one. Match the general logic flow of the
3604df
other fop-cbks and eliminate the unused variable and its associated
3604df
warning
3604df
3604df
also see comment in patch set seven, re: correct handling of
3604df
client_process_response(); and the associated BZ
3604df
https://bugzilla.redhat.com/show_bug.cgi?id=1376328
3604df
3604df
http://review.gluster.org/14085 fixes a "pragma leak" where the
3604df
generated rpc/xdr headers have a pair of pragmas that disable these
3604df
warnings. With the warnings disabled, many unused variables have
3604df
crept into the code base.
3604df
3604df
And 14085 won't pass its own smoke test until all these warnings are
3604df
fixed.
3604df
3604df
Change-Id: I52f63e563f7ce827a5e00fd5af3e46182f1483e2
3604df
BUG: 1405299
3604df
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
3604df
Reviewed-on: https://code.engineering.redhat.com/gerrit/93157
3604df
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
3604df
Tested-by: Atin Mukherjee <amukherj@redhat.com>
3604df
---
3604df
 xlators/protocol/client/src/client-rpc-fops.c | 20 +++++++++++++++-----
3604df
 1 file changed, 15 insertions(+), 5 deletions(-)
3604df
3604df
diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c
3604df
index c2dadac..e289086 100644
3604df
--- a/xlators/protocol/client/src/client-rpc-fops.c
3604df
+++ b/xlators/protocol/client/src/client-rpc-fops.c
3604df
@@ -3165,7 +3165,6 @@ client3_3_compound_cbk (struct rpc_req *req, struct iovec *iov, int count,
3604df
         xlator_t                *this            = NULL;
3604df
         dict_t                  *xdata           = NULL;
3604df
         clnt_local_t            *local           = NULL;
3604df
-        int                     op_errno         = 0;
3604df
         int                     i                = 0;
3604df
         int                     length           = 0;
3604df
         int                     ret              = -1;
3604df
@@ -3176,7 +3175,8 @@ client3_3_compound_cbk (struct rpc_req *req, struct iovec *iov, int count,
3604df
         local = frame->local;
3604df
 
3604df
         if (-1 == req->rpc_status) {
3604df
-                op_errno = ENOTCONN;
3604df
+                rsp.op_ret   = -1;
3604df
+                rsp.op_errno = ENOTCONN;
3604df
                 goto out;
3604df
         }
3604df
 
3604df
@@ -3184,7 +3184,8 @@ client3_3_compound_cbk (struct rpc_req *req, struct iovec *iov, int count,
3604df
         if (ret < 0) {
3604df
                 gf_msg (this->name, GF_LOG_ERROR, EINVAL,
3604df
                         PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
3604df
-                op_errno = EINVAL;
3604df
+                rsp.op_ret   = -1;
3604df
+                rsp.op_errno = EINVAL;
3604df
                 goto out;
3604df
         }
3604df
 
3604df
@@ -3196,21 +3197,30 @@ client3_3_compound_cbk (struct rpc_req *req, struct iovec *iov, int count,
3604df
 
3604df
         args_cbk = compound_args_cbk_alloc (length, xdata);
3604df
         if (!args_cbk) {
3604df
-                op_errno = ENOMEM;
3604df
+                rsp.op_ret = -1;
3604df
+                rsp.op_errno = ENOMEM;
3604df
                 goto out;
3604df
         }
3604df
 
3604df
+        /* TODO: see https://bugzilla.redhat.com/show_bug.cgi?id=1376328 */
3604df
         for (i = 0; i < args_cbk->fop_length; i++) {
3604df
                 ret = client_process_response (frame, this, req, &rsp,
3604df
                                                args_cbk, i);
3604df
                 if (ret) {
3604df
-                        op_errno = -ret;
3604df
+                        rsp.op_ret = -1;
3604df
+                        rsp.op_errno = -ret;
3604df
                         goto out;
3604df
                 }
3604df
 
3604df
         }
3604df
         rsp.op_ret = 0;
3604df
 out:
3604df
+        if (rsp.op_ret == -1) {
3604df
+                gf_msg (this->name, GF_LOG_WARNING,
3604df
+                        gf_error_to_errno (rsp.op_errno),
3604df
+                        PC_MSG_REMOTE_OP_FAILED,
3604df
+                        "remote operation failed");
3604df
+        }
3604df
         CLIENT_STACK_UNWIND (compound, frame, rsp.op_ret,
3604df
                              gf_error_to_errno (rsp.op_errno), args_cbk, xdata);
3604df
 
3604df
-- 
3604df
2.9.3
3604df