summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-transaction.c
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2018-05-17 08:23:33 +0530
committerRavishankar N <ravishankar@redhat.com>2018-06-18 16:51:46 +0530
commit0f13eed0c1fa74cefed486538b02e0c8a8708456 (patch)
tree786502eaa28e71ae9567b8d8653a402f63c7001a /xlators/cluster/afr/src/afr-transaction.c
parent67de708df134cc9f2edf408f2dd9a7ed1a1ef817 (diff)
afr: don't update readables if inode refresh failed on all children
Problem: 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: Ia638c092d8d12dc27afb3cdad133394845061319 updates: bz#1584483 Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-transaction.c')
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index 9c0963781e3..bfea096cf3b 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -2452,7 +2452,7 @@ afr_write_txn_refresh_done (call_frame_t *frame, xlator_t *this, int err)
afr_local_t *local = frame->local;
if (err) {
- AFR_SET_ERROR_AND_CHECK_SPLIT_BRAIN(-1, -err);
+ AFR_SET_ERROR_AND_CHECK_SPLIT_BRAIN(-1, err);
goto fail;
}
@@ -2478,6 +2478,11 @@ afr_transaction (call_frame_t *frame, xlator_t *this, afr_transaction_type type)
local->transaction.type = type;
+ if (priv->quorum_count && !afr_has_quorum (local->child_up, this)) {
+ ret = -afr_quorum_errno(priv);
+ goto out;
+ }
+
if (!afr_is_consistent_io_possible (local, priv, &ret)) {
ret = -ret; /*op_errno to ret conversion*/
goto out;