summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-read-txn.c
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2018-07-09 15:10:04 +0530
committerjiffin tony Thottan <jthottan@redhat.com>2018-07-11 14:04:25 +0000
commitc530352ff2f5dc96631154f2b9a193d99cedd9bc (patch)
tree0a09cfbc4198c5e2830ad00344df6ea3178345e8 /xlators/cluster/afr/src/afr-read-txn.c
parentc1758216a39232e5592e0e34999fed48420fc5ac (diff)
afr: don't update readables if inode refresh failed on all children
Backport of: https://review.gluster.org/#/c/20029/ 3.12 still supports quorum-reads, hence modified afr_inode_refresh_done() to support that. If inode refresh failed on all children of afr due to ENOENT (say file migrated by dht), it resets the readables to zero. Any inflight txn which then later comes on the inode fails with EIO because no readable children present for the inode. Fix: Don't update readables when inode refresh fails on *all* children of afr. In that way any inflight txns will either proceed with its own inode refresh if needed and fail it with the right errno or use the old value of readables and continue with the txn. Also, add quorum checks to the beginning of afr_transaction(). Otherwise, we seem to be winding the lock and checking for quorum only in pre-op pahse. Note: This should ideally fix BZ 1329505 since the stop gap fix for it is has been reverted at https://review.gluster.org/#/c/20028. Change-Id: I82990769f01be918a073fec83fc67ba4b3be24b1 BUG: 1599247 Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-read-txn.c')
-rw-r--r--xlators/cluster/afr/src/afr-read-txn.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/xlators/cluster/afr/src/afr-read-txn.c b/xlators/cluster/afr/src/afr-read-txn.c
index 50e8040d33e..3e930a9db37 100644
--- a/xlators/cluster/afr/src/afr-read-txn.c
+++ b/xlators/cluster/afr/src/afr-read-txn.c
@@ -68,7 +68,7 @@ afr_read_txn_refresh_done (call_frame_t *frame, xlator_t *this, int err)
read_subvol = afr_read_subvol_select_by_policy (inode, this,
local->readable, NULL);
if (read_subvol == -1) {
- err = -EIO;
+ err = EIO;
goto readfn;
}
@@ -87,7 +87,7 @@ readfn:
}
if (read_subvol == -1) {
- AFR_SET_ERROR_AND_CHECK_SPLIT_BRAIN (-1, -err);
+ AFR_SET_ERROR_AND_CHECK_SPLIT_BRAIN (-1, err);
}
local->readfn (frame, this, read_subvol);
@@ -196,7 +196,7 @@ afr_read_txn (call_frame_t *frame, xlator_t *this, inode_t *inode,
if (priv->quorum_reads &&
priv->quorum_count && !afr_has_quorum (priv->child_up, this)) {
local->op_ret = -1;
- local->op_errno = ENOTCONN;
+ local->op_errno = afr_quorum_errno(priv);
read_subvol = -1;
goto read;
}