Blob Blame History Raw
From 0133189f7d2ada916b54a3f3930d122263696189 Mon Sep 17 00:00:00 2001
From: Krutika Dhananjay <kdhananj@redhat.com>
Date: Tue, 8 Nov 2016 17:24:41 +0530
Subject: [PATCH 163/206] cluster/afr: When failing fop due to lack of quorum,
 also log error string

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

Change-Id: Ide03078b5a0ab320668fbd8fd7cfb028198c745d
BUG: 1394219
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/90066
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
---
 xlators/cluster/afr/src/afr-transaction.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index 856ea6e..fe53f49 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -791,6 +791,16 @@ afr_handle_quorum (call_frame_t *frame)
         if (afr_has_fop_cbk_quorum (frame))
                 return;
 
+        for (i = 0; i < priv->child_count; i++) {
+                if (local->transaction.pre_op[i])
+                        afr_transaction_fop_failed (frame, frame->this, i);
+        }
+
+        local->op_ret = -1;
+        local->op_errno = afr_final_errno (local, priv);
+        if (local->op_errno == 0)
+                local->op_errno = afr_quorum_errno (priv);
+
         if (local->fd) {
                 gf_uuid_copy (gfid, local->fd->inode->gfid);
                 file = uuid_utoa (gfid);
@@ -799,19 +809,10 @@ afr_handle_quorum (call_frame_t *frame)
                 file = local->loc.path;
         }
 
-        gf_msg (frame->this->name, GF_LOG_WARNING, 0, AFR_MSG_QUORUM_FAIL,
-                "%s: Failing %s as quorum is not met",
+        gf_msg (frame->this->name, GF_LOG_WARNING, local->op_errno,
+                AFR_MSG_QUORUM_FAIL, "%s: Failing %s as quorum is not met",
                 file, gf_fop_list[local->op]);
 
-        for (i = 0; i < priv->child_count; i++) {
-                if (local->transaction.pre_op[i])
-                        afr_transaction_fop_failed (frame, frame->this, i);
-        }
-
-        local->op_ret = -1;
-        local->op_errno = afr_final_errno (local, priv);
-        if (local->op_errno == 0)
-                local->op_errno = afr_quorum_errno (priv);
         switch (local->transaction.type) {
         case AFR_ENTRY_TRANSACTION:
         case AFR_ENTRY_RENAME_TRANSACTION:
-- 
2.9.3