summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-transaction.c
diff options
context:
space:
mode:
authorkarthik-us <ksubrahm@redhat.com>2018-12-04 11:19:27 +0530
committerRavishankar N <ravishankar@redhat.com>2018-12-18 10:30:19 +0000
commit9662504d45f3e285772f5188a7edf7ae3665cc6a (patch)
tree5541bccdb72488711a21d9604ef90afbd91bf23b /xlators/cluster/afr/src/afr-transaction.c
parentb87c397091bac6a4a6dec4e45a7671fad4a11770 (diff)
cluster/afr: Allow lookup on root if it is from ADD_REPLICA_MOUNT
Problem: When trying to convert a plain distribute volume to replica-3 or arbiter type it is failing with ENOTCONN error as the lookup on the root will fail as there is no quorum. Fix: Allow lookup on root if it is coming from the ADD_REPLICA_MOUNT which is used while adding bricks to a volume. It will try to set the pending xattrs for the newly added bricks to allow the heal to happen in the right direction and avoid data loss scenarios. Note: This fix will solve the problem of type conversion only in the case where the volume was mounted at least once. The conversion of non mounted volumes will still fail since the dht selfheal tries to set the directory layout will fail as they do that with the PID GF_CLIENT_PID_NO_ROOT_SQUASH set in the frame->root. Change-Id: Ic511939981dad118cc946754341318b164954b3b fixes: bz#1655854 Signed-off-by: karthik-us <ksubrahm@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-transaction.c')
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index ab3a121efe3..8d97ff53253 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -242,7 +242,7 @@ afr_changelog_has_quorum(afr_local_t *local, xlator_t *this)
}
}
- if (afr_has_quorum(success_children, this)) {
+ if (afr_has_quorum(success_children, this, NULL)) {
return _gf_true;
}
@@ -869,7 +869,7 @@ afr_handle_symmetric_errors(call_frame_t *frame, xlator_t *this)
}
gf_boolean_t
-afr_has_quorum(unsigned char *subvols, xlator_t *this)
+afr_has_quorum(unsigned char *subvols, xlator_t *this, call_frame_t *frame)
{
unsigned int quorum_count = 0;
afr_private_t *priv = NULL;
@@ -878,6 +878,9 @@ afr_has_quorum(unsigned char *subvols, xlator_t *this)
priv = this->private;
up_children_count = AFR_COUNT(subvols, priv->child_count);
+ if (afr_lookup_has_quorum(frame, this, subvols))
+ return _gf_true;
+
if (priv->quorum_count == AFR_QUORUM_AUTO) {
/*
* Special case for auto-quorum with an even number of nodes.
@@ -932,7 +935,7 @@ afr_has_fop_quorum(call_frame_t *frame)
locked_nodes = afr_locked_nodes_get(local->transaction.type,
&local->internal_lock);
- return afr_has_quorum(locked_nodes, this);
+ return afr_has_quorum(locked_nodes, this, NULL);
}
static gf_boolean_t
@@ -950,7 +953,7 @@ afr_has_fop_cbk_quorum(call_frame_t *frame)
success[i] = 1;
}
- return afr_has_quorum(success, this);
+ return afr_has_quorum(success, this, NULL);
}
gf_boolean_t
@@ -2882,7 +2885,7 @@ 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)) {
+ if (priv->quorum_count && !afr_has_quorum(local->child_up, this, NULL)) {
ret = -afr_quorum_errno(priv);
goto out;
}