From 2a0f905c905de4ad1e74bf4c7998adf087756785 Mon Sep 17 00:00:00 2001 From: karthik-us Date: Thu, 21 Feb 2019 16:17:44 +0530 Subject: cluster/afr: Add quorum checks to open & opendir fops Problem: Currently even if open & opendir fails on quorum number of bricks, but succeeds on atleast one brick, it will result in success. This leads to inconsistency in the behaviour with other operations following the open, which has quorum checks. Fix: Add quorum checks to open & opendir fops to avoid inconsistency. Change-Id: If8fcb82072a6dc45ea6d4a6754b79763215eba2a fixes: bz#1634664 Signed-off-by: karthik-us --- xlators/cluster/afr/src/afr-common.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'xlators/cluster/afr/src/afr-common.c') diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 45b96e33970..8a14be98ac0 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -7013,3 +7013,21 @@ afr_lookup_has_quorum(call_frame_t *frame, xlator_t *this, return _gf_false; } + +void +afr_handle_replies_quorum(call_frame_t *frame, xlator_t *this) +{ + afr_local_t *local = frame->local; + afr_private_t *priv = this->private; + unsigned char *success_replies = NULL; + + success_replies = alloca0(priv->child_count); + afr_fill_success_replies(local, priv, success_replies); + + if (priv->quorum_count && !afr_has_quorum(success_replies, this, NULL)) { + local->op_errno = afr_final_errno(local, priv); + if (!local->op_errno) + local->op_errno = afr_quorum_errno(priv); + local->op_ret = -1; + } +} -- cgit