summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-common.c
diff options
context:
space:
mode:
authorAnuradha Talur <atalur@redhat.com>2015-09-11 18:43:36 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2015-09-14 02:56:53 -0700
commitfa08597a004b591afbeb478d0a736ec09066f648 (patch)
tree855b85e44331fc9585fb19e1291faa836248dc4c /xlators/cluster/afr/src/afr-common.c
parent2e041639d8e49e2b768dd43c6f702106250e4da9 (diff)
afr : get split-brain-status in a synctask
On executing `getfattr -n replica.split-brain-status <file>` on mount, there is a possibility that the mount hangs. To avoid this hang, fetch the split-brain-status of a file in synctask. Change-Id: I87b781419ffc63248f915325b845e3233143d385 BUG: 1262345 Signed-off-by: Anuradha Talur <atalur@redhat.com> Reviewed-on: http://review.gluster.org/12163 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Ravishankar N <ravishankar@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-common.c')
-rw-r--r--xlators/cluster/afr/src/afr-common.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 66d04b7c8c5..ce9c1ce110a 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -4583,8 +4583,7 @@ out:
}
int
-afr_get_heal_info (call_frame_t *frame, xlator_t *this, loc_t *loc,
- dict_t *xdata)
+afr_get_heal_info (call_frame_t *frame, xlator_t *this, loc_t *loc)
{
gf_boolean_t data_selfheal = _gf_false;
gf_boolean_t metadata_selfheal = _gf_false;
@@ -4709,7 +4708,14 @@ out:
}
int
-afr_get_split_brain_status (call_frame_t *frame, xlator_t *this, loc_t *loc)
+afr_get_split_brain_status_cbk (int ret, call_frame_t *frame, void *opaque)
+{
+ GF_FREE (opaque);
+ return 0;
+}
+
+int
+afr_get_split_brain_status (void *opaque)
{
gf_boolean_t d_spb = _gf_false;
gf_boolean_t m_spb = _gf_false;
@@ -4722,7 +4728,15 @@ afr_get_split_brain_status (call_frame_t *frame, xlator_t *this, loc_t *loc)
inode_t *inode = NULL;
afr_private_t *priv = NULL;
xlator_t **children = NULL;
-
+ call_frame_t *frame = NULL;
+ xlator_t *this = NULL;
+ loc_t *loc = NULL;
+ afr_spb_status_t *data = NULL;
+
+ data = opaque;
+ frame = data->frame;
+ this = frame->this;
+ loc = data->loc;
priv = this->private;
children = priv->children;
@@ -4772,14 +4786,20 @@ afr_get_split_brain_status (call_frame_t *frame, xlator_t *this, loc_t *loc)
goto out;
}
ret = dict_set_dynstr (dict, GF_AFR_SBRAIN_STATUS, status);
- if (ret)
+ if (ret) {
+ op_errno = -ret;
+ ret = -1;
goto out;
+ }
} else {
ret = dict_set_str (dict, GF_AFR_SBRAIN_STATUS,
"The file is not under data or"
" metadata split-brain");
- if (ret)
+ if (ret) {
+ op_errno = -ret;
+ ret = -1;
goto out;
+ }
}
ret = 0;