a3470f
From 9b0122cbe61047c9591de447bb19a6028b69861c Mon Sep 17 00:00:00 2001
a3470f
From: Ravishankar N <ravishankar@redhat.com>
a3470f
Date: Tue, 30 Jan 2018 20:59:23 +0530
a3470f
Subject: [PATCH 154/180] afr: capture the correct errno in post-op quorum
a3470f
 check
a3470f
a3470f
Backport of https://review.gluster.org/#/c/19366/
a3470f
a3470f
If the post-op phase of txn did not meet quorm checks, use that errno to
a3470f
unwind the FOP rather than blindly setting ENOTCONN.
a3470f
a3470f
Change-Id: I0cb0c8771ec75a45f9a25ad4cd8601103deddf0c
a3470f
BUG: 1384983
a3470f
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/129221
a3470f
Tested-by: RHGS Build Bot <nigelb@redhat.com>
a3470f
---
a3470f
 xlators/cluster/afr/src/afr-transaction.c | 16 ++++++++--------
a3470f
 1 file changed, 8 insertions(+), 8 deletions(-)
a3470f
a3470f
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
a3470f
index 18d2ded..19740e1 100644
a3470f
--- a/xlators/cluster/afr/src/afr-transaction.c
a3470f
+++ b/xlators/cluster/afr/src/afr-transaction.c
a3470f
@@ -534,8 +534,8 @@ afr_lock_server_count (afr_private_t *priv, afr_transaction_type type)
a3470f
 /* {{{ pending */
a3470f
 
a3470f
 
a3470f
-gf_boolean_t
a3470f
-afr_post_op_has_quorum (afr_local_t *local, xlator_t *this)
a3470f
+void
a3470f
+afr_handle_post_op_quorum (afr_local_t *local, xlator_t *this)
a3470f
 {
a3470f
         afr_private_t *priv = NULL;
a3470f
         int i = 0;
a3470f
@@ -551,10 +551,13 @@ afr_post_op_has_quorum (afr_local_t *local, xlator_t *this)
a3470f
         }
a3470f
 
a3470f
         if (afr_has_quorum (post_op_children, this)) {
a3470f
-                return _gf_true;
a3470f
+                return;
a3470f
         }
a3470f
 
a3470f
-        return _gf_false;
a3470f
+        local->op_ret = -1;
a3470f
+        /*local->op_errno is already captured in post-op callback.*/
a3470f
+
a3470f
+        return;
a3470f
 }
a3470f
 
a3470f
 int
a3470f
@@ -569,10 +572,7 @@ afr_changelog_post_op_done (call_frame_t *frame, xlator_t *this)
a3470f
         int_lock = &local->internal_lock;
a3470f
 
a3470f
         /* Fail the FOP if post-op did not succeed on quorum no. of bricks. */
a3470f
-        if (!afr_post_op_has_quorum (local, this)) {
a3470f
-                local->op_ret = -1;
a3470f
-                local->op_errno = ENOTCONN;
a3470f
-        }
a3470f
+        afr_handle_post_op_quorum (local, this);
a3470f
 
a3470f
 	if (local->transaction.resume_stub) {
a3470f
 		call_resume (local->transaction.resume_stub);
a3470f
-- 
a3470f
1.8.3.1
a3470f