summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-10-28 11:48:02 +0530
committerVijay Bellur <vbellur@redhat.com>2014-11-05 21:36:55 -0800
commit8528253ddbac4cbcb7ce4881c085d9bfc0a82703 (patch)
treee9389aff7e11f952dca4e86c570d64f730f974ab
parent08109ed5a7e09ec14ecb3640cfcaf9b32d83499b (diff)
cluster/afr: Preserve errno in case of failures on all subvols
Problem: When quorum is enabled and the fop fails on all the subvolumes, op_errno is set to EROFS which overrides the actual errno returned from bricks. Fix: Don't override the errno when fop fails on all subvols. Change-Id: I61e57bbf1a69407230ec172a983de18d1c624fd2 BUG: 1157976 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/8984 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-by: Harshavardhana <harsha@harshavardhana.net> Tested-by: Harshavardhana <harsha@harshavardhana.net> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index d287e6ab66c..bb582b5940f 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -507,6 +507,10 @@ afr_handle_quorum (call_frame_t *frame)
if (priv->quorum_count == 0)
return;
+ /* If the fop already failed return right away to preserve errno */
+ if (local->op_ret == -1)
+ return;
+
/*
* Network split may happen just after the fops are unwound, so check
* if the fop succeeded in a way it still follows quorum. If it doesn't,
@@ -975,16 +979,23 @@ afr_changelog_pre_op (call_frame_t *frame, xlator_t *this)
}
}
- if (priv->quorum_count && !afr_has_fop_quorum (frame)) {
- op_errno = EROFS;
- goto err;
- }
-
+ /* This condition should not be met with present code, as
+ * transaction.done will be called if locks are not acquired on even a
+ * single node.
+ */
if (call_count == 0) {
op_errno = ENOTCONN;
goto err;
}
+ /* Check if the fop can be performed on at least
+ * quorum number of nodes.
+ */
+ if (priv->quorum_count && !afr_has_fop_quorum (frame)) {
+ op_errno = EROFS;
+ goto err;
+ }
+
xdata_req = dict_new();
if (!xdata_req) {
op_errno = ENOMEM;