From 0895aa838086ff8dfbdb2c32f2e8268afd688d17 Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Tue, 20 Dec 2016 07:05:02 +0530 Subject: [PATCH 250/257] afr: Ignore event_generation checks post inode refresh for write txns Backport of http://review.gluster.org/#/c/16205/ Before https://code.engineering.redhat.com/gerrit/91354, after inode refresh, we failed read txns in case of EIO or event_generation being zero. For write transactions, the check was only for EIO. 91354 re-factored the code to fail both read and write when event_generation=0. This seems to have caused a regression as explained in the BZ. This patch restores that behaviour in afr_txn_refresh_done(). Change-Id: I4dd5c56f9a5b451744b5426f5ddcfcad2a8ed20e BUG: 1404982 Signed-off-by: Ravishankar N Reviewed-on: https://code.engineering.redhat.com/gerrit/93560 Reviewed-by: Pranith Kumar Karampuri --- xlators/cluster/afr/src/afr-common.c | 2 +- xlators/cluster/afr/src/afr-read-txn.c | 1 + xlators/cluster/afr/src/afr.h | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 60bae18..2e93ba9 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -1089,7 +1089,7 @@ afr_txn_refresh_done (call_frame_t *frame, xlator_t *this, int err) &event_generation, local->transaction.type); - if (ret == -EIO || !event_generation) { + if (ret == -EIO || (local->is_read_txn && !event_generation)) { /* No readable subvolume even after refresh ==> splitbrain.*/ if (!priv->fav_child_policy) { err = -EIO; diff --git a/xlators/cluster/afr/src/afr-read-txn.c b/xlators/cluster/afr/src/afr-read-txn.c index fa98d37..6ed1bcd 100644 --- a/xlators/cluster/afr/src/afr-read-txn.c +++ b/xlators/cluster/afr/src/afr-read-txn.c @@ -201,6 +201,7 @@ afr_read_txn (call_frame_t *frame, xlator_t *this, inode_t *inode, local->readfn = readfn; local->inode = inode_ref (inode); + local->is_read_txn = _gf_true; if (priv->quorum_reads && priv->quorum_count && !afr_has_quorum (priv->child_up, this)) { diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 63002cd..69d0584 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -807,6 +807,8 @@ typedef struct _afr_local { gf_boolean_t compound; afr_fop_lock_state_t fop_lock_state; compound_args_t *c_args; + + gf_boolean_t is_read_txn; } afr_local_t; -- 2.9.3