summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr.c
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2011-12-15 16:51:02 +0530
committerVijay Bellur <vijay@gluster.com>2011-12-28 22:47:36 -0800
commitbe003fbb3ac7a1f1021774ecb75a4929f1ba85d4 (patch)
tree099f4354f4d4fa140f607c374e295b6166db23ad /xlators/cluster/afr/src/afr.c
parentc8c0942d1c890fd9b74c8e2fb3897bc96f9b9b82 (diff)
cluster/afr: Handle fini for afr,pumpv3.3.0qa19
Change-Id: Idc0a05a8a25f278a7ab05e242263e0a5001bde18 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> BUG: 767862 Reviewed-on: http://review.gluster.com/800 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr.c')
-rw-r--r--xlators/cluster/afr/src/afr.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index c66f386f2fe..f3c3e7e7a82 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -85,18 +85,6 @@ xlator_subvolume_index (xlator_t *this, xlator_t *subvol)
return index;
}
-
-int
-xlator_subvolume_count (xlator_t *this)
-{
- int i = 0;
- xlator_list_t *list = NULL;
-
- for (list = this->children; list; list = list->next)
- i++;
- return i;
-}
-
void
fix_quorum_options (xlator_t *this, afr_private_t *priv, char *qtype)
{
@@ -219,6 +207,16 @@ init (xlator_t *this)
ALLOC_OR_GOTO (this->private, afr_private_t, out);
priv = this->private;
+ LOCK_INIT (&priv->lock);
+ LOCK_INIT (&priv->read_child_lock);
+ //lock recovery is not done in afr
+ pthread_mutex_init (&priv->mutex, NULL);
+ INIT_LIST_HEAD (&priv->saved_fds);
+
+ child_count = xlator_subvolume_count (this);
+
+ priv->child_count = child_count;
+
priv->read_child = -1;
@@ -287,13 +285,6 @@ init (xlator_t *this)
priv->wait_count = 1;
- child_count = xlator_subvolume_count (this);
-
- priv->child_count = child_count;
-
- LOCK_INIT (&priv->lock);
- LOCK_INIT (&priv->read_child_lock);
-
priv->child_up = GF_CALLOC (sizeof (unsigned char), child_count,
gf_afr_mt_char);
if (!priv->child_up) {
@@ -356,13 +347,9 @@ init (xlator_t *this)
goto out;
}
- LOCK_INIT (&priv->root_inode_lk);
priv->first_lookup = 1;
priv->root_inode = NULL;
- pthread_mutex_init (&priv->mutex, NULL);
- INIT_LIST_HEAD (&priv->saved_fds);
-
ret = 0;
out:
return ret;
@@ -372,6 +359,11 @@ out:
int
fini (xlator_t *this)
{
+ afr_private_t *priv = NULL;
+
+ priv = this->private;
+ this->private = NULL;
+ afr_priv_destroy (priv);
return 0;
}