summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2016-12-01 09:42:19 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-12-06 22:47:40 -0800
commita7d7ed90c9272a42168a91f92754d3a4be605da5 (patch)
treee9416ea05af8da3473bb77921f2aeacff1d04f62 /xlators/cluster/afr/src
parent622787887735d9157feac6cc57745251baca7b78 (diff)
cluster/afr: Serialize conflicting locks on all subvols
Problem: 1) When a blocking lock is issued and the parallel lock phase fails on all subvolumes with EAGAIN, it is not switching to serialized locking phase. 2) When quorum is enabled and locks fail partially it is better to give errno returned by brick rather than the default quorum errno. Fix: Handled this error case and changed op_errno to reflect the actual errno in case of quorum error. BUG: 1369077 Change-Id: Ifac2e4a13686e9fde601873012700966d56a7f31 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/15984 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Ravishankar N <ravishankar@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src')
-rw-r--r--xlators/cluster/afr/src/afr-common.c82
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c4
2 files changed, 53 insertions, 33 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index bce955cfd03..80aea0c7d62 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -3592,43 +3592,19 @@ afr_fop_lock_wind (call_frame_t *frame, xlator_t *this, int child_index,
}
}
-static int32_t
-afr_unlock_partial_lock_cbk (call_frame_t *frame, void *cookie,
- xlator_t *this, int32_t op_ret,
- int32_t op_errno, dict_t *xdata)
-
+void
+afr_fop_lock_proceed (call_frame_t *frame)
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
- int call_count = -1;
- int child_index = (long)cookie;
- uuid_t gfid = {0};
local = frame->local;
- priv = this->private;
-
- if (op_ret < 0 && op_errno != ENOTCONN) {
- if (local->fd)
- gf_uuid_copy (gfid, local->fd->inode->gfid);
- else
- loc_gfid (&local->loc, gfid);
- gf_msg (this->name, GF_LOG_ERROR, op_errno,
- AFR_MSG_UNLOCK_FAIL,
- "%s: Failed to unlock %s on %s "
- "with lk_owner: %s", uuid_utoa (gfid),
- gf_fop_list[local->op],
- priv->children[child_index]->name,
- lkowner_utoa (&frame->root->lk_owner));
- }
-
- call_count = afr_frame_return (frame);
- if (call_count)
- goto out;
+ priv = frame->this->private;
if (local->fop_lock_state != AFR_FOP_LOCK_PARALLEL) {
afr_fop_lock_unwind (frame, local->op, local->op_ret,
local->op_errno, local->xdata_rsp);
- goto out;
+ return;
}
/* At least one child is up */
/*
@@ -3672,8 +3648,42 @@ afr_unlock_partial_lock_cbk (call_frame_t *frame, void *cookie,
default:
break;
}
- afr_serialized_lock_wind (frame, this);
-out:
+ afr_serialized_lock_wind (frame, frame->this);
+}
+
+static int32_t
+afr_unlock_partial_lock_cbk (call_frame_t *frame, void *cookie,
+ xlator_t *this, int32_t op_ret,
+ int32_t op_errno, dict_t *xdata)
+
+{
+ afr_local_t *local = NULL;
+ afr_private_t *priv = NULL;
+ int call_count = -1;
+ int child_index = (long)cookie;
+ uuid_t gfid = {0};
+
+ local = frame->local;
+ priv = this->private;
+
+ if (op_ret < 0 && op_errno != ENOTCONN) {
+ if (local->fd)
+ gf_uuid_copy (gfid, local->fd->inode->gfid);
+ else
+ loc_gfid (&local->loc, gfid);
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ AFR_MSG_UNLOCK_FAIL,
+ "%s: Failed to unlock %s on %s "
+ "with lk_owner: %s", uuid_utoa (gfid),
+ gf_fop_list[local->op],
+ priv->children[child_index]->name,
+ lkowner_utoa (&frame->root->lk_owner));
+ }
+
+ call_count = afr_frame_return (frame);
+ if (call_count == 0)
+ afr_fop_lock_proceed (frame);
+
return 0;
}
@@ -3685,6 +3695,11 @@ afr_unlock_locks_and_proceed (call_frame_t *frame, xlator_t *this,
afr_private_t *priv = NULL;
afr_local_t *local = NULL;
+ if (call_count == 0) {
+ afr_fop_lock_proceed (frame);
+ goto out;
+ }
+
local = frame->local;
priv = this->private;
local->call_count = call_count;
@@ -3721,6 +3736,7 @@ afr_unlock_locks_and_proceed (call_frame_t *frame, xlator_t *this,
break;
}
+out:
return 0;
}
@@ -3763,7 +3779,7 @@ afr_fop_lock_done (call_frame_t *frame, xlator_t *this)
local->op_errno = local->replies[i].op_errno;
}
- if (afr_fop_lock_is_unlock (frame) || (lock_count == 0))
+ if (afr_fop_lock_is_unlock (frame))
goto unwind;
if (afr_is_conflicting_lock_present (local->op_ret, local->op_errno)) {
@@ -3771,7 +3787,9 @@ afr_fop_lock_done (call_frame_t *frame, xlator_t *this)
} else if (priv->quorum_count && !afr_has_quorum (success, this)) {
local->fop_lock_state = AFR_FOP_LOCK_QUORUM_FAILED;
local->op_ret = -1;
- local->op_errno = afr_quorum_errno (priv);
+ local->op_errno = afr_final_errno (local, priv);
+ if (local->op_errno == 0)
+ local->op_errno = afr_quorum_errno (priv);
afr_unlock_locks_and_proceed (frame, this, lock_count);
} else {
goto unwind;
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index 6bfe249d4eb..aef594bfc12 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -1679,7 +1679,9 @@ afr_changelog_pre_op (call_frame_t *frame, xlator_t *this)
* quorum number of nodes.
*/
if (priv->quorum_count && !afr_has_fop_quorum (frame)) {
- op_errno = afr_quorum_errno (priv);
+ op_errno = int_lock->lock_op_errno;
+ if (op_errno == 0)
+ op_errno = afr_quorum_errno (priv);
goto err;
}