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