233933
From 33d59c74169192b4ba89abc915d8d785bc450fbb Mon Sep 17 00:00:00 2001
233933
From: Mohammed Rafi KC <rkavunga@redhat.com>
233933
Date: Thu, 11 Jul 2019 12:49:54 +0530
233933
Subject: [PATCH 247/255] Revert "afr/shd: Cleanup self heal daemon resources
233933
 during afr fini"
233933
233933
This reverts commit faaaa3452ceec6afcc18cffc9beca3fe19841cce.
233933
233933
BUG: 1471742
233933
Change-Id: Id4a22ab45b89872684830f866ec4b589fca50a90
233933
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
233933
Reviewed-on: https://code.engineering.redhat.com/gerrit/175956
233933
Tested-by: RHGS Build Bot <nigelb@redhat.com>
233933
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
233933
---
233933
 libglusterfs/src/syncop-utils.c          |  8 -----
233933
 xlators/cluster/afr/src/afr-self-heald.c |  2 --
233933
 xlators/cluster/afr/src/afr.c            | 57 --------------------------------
233933
 3 files changed, 67 deletions(-)
233933
233933
diff --git a/libglusterfs/src/syncop-utils.c b/libglusterfs/src/syncop-utils.c
233933
index b842142..be03527 100644
233933
--- a/libglusterfs/src/syncop-utils.c
233933
+++ b/libglusterfs/src/syncop-utils.c
233933
@@ -350,11 +350,6 @@ syncop_mt_dir_scan(call_frame_t *frame, xlator_t *subvol, loc_t *loc, int pid,
233933
     gf_boolean_t cond_init = _gf_false;
233933
     gf_boolean_t mut_init = _gf_false;
233933
     gf_dirent_t entries;
233933
-    xlator_t *this = NULL;
233933
-
233933
-    if (frame) {
233933
-        this = frame->this;
233933
-    }
233933
 
233933
     /*For this functionality to be implemented in general, we need
233933
      * synccond_t infra which doesn't block the executing thread. Until then
233933
@@ -402,9 +397,6 @@ syncop_mt_dir_scan(call_frame_t *frame, xlator_t *subvol, loc_t *loc, int pid,
233933
 
233933
         list_for_each_entry_safe(entry, tmp, &entries.list, list)
233933
         {
233933
-            if (this && this->cleanup_starting)
233933
-                goto out;
233933
-
233933
             list_del_init(&entry->list);
233933
             if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..")) {
233933
                 gf_dirent_entry_free(entry);
233933
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
233933
index 8bc4720..7eb1207 100644
233933
--- a/xlators/cluster/afr/src/afr-self-heald.c
233933
+++ b/xlators/cluster/afr/src/afr-self-heald.c
233933
@@ -373,7 +373,6 @@ afr_shd_sweep_prepare(struct subvol_healer *healer)
233933
 
233933
     time(&event->start_time);
233933
     event->end_time = 0;
233933
-    _mask_cancellation();
233933
 }
233933
 
233933
 void
233933
@@ -395,7 +394,6 @@ afr_shd_sweep_done(struct subvol_healer *healer)
233933
 
233933
     if (eh_save_history(shd->statistics[healer->subvol], history) < 0)
233933
         GF_FREE(history);
233933
-    _unmask_cancellation();
233933
 }
233933
 
233933
 int
233933
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
233933
index a0a7551..33258a0 100644
233933
--- a/xlators/cluster/afr/src/afr.c
233933
+++ b/xlators/cluster/afr/src/afr.c
233933
@@ -611,70 +611,13 @@ init(xlator_t *this)
233933
 out:
233933
     return ret;
233933
 }
233933
-void
233933
-afr_destroy_healer_object(xlator_t *this, struct subvol_healer *healer)
233933
-{
233933
-    int ret = -1;
233933
-
233933
-    if (!healer)
233933
-        return;
233933
-
233933
-    if (healer->running) {
233933
-        /*
233933
-         * If there are any resources to cleanup, We need
233933
-         * to do that gracefully using pthread_cleanup_push
233933
-         */
233933
-        ret = gf_thread_cleanup_xint(healer->thread);
233933
-        if (ret)
233933
-            gf_msg(this->name, GF_LOG_WARNING, 0, AFR_MSG_SELF_HEAL_FAILED,
233933
-                   "Failed to clean up healer threads.");
233933
-        healer->thread = 0;
233933
-    }
233933
-    pthread_cond_destroy(&healer->cond);
233933
-    pthread_mutex_destroy(&healer->mutex);
233933
-}
233933
-
233933
-void
233933
-afr_selfheal_daemon_fini(xlator_t *this)
233933
-{
233933
-    struct subvol_healer *healer = NULL;
233933
-    afr_self_heald_t *shd = NULL;
233933
-    afr_private_t *priv = NULL;
233933
-    int i = 0;
233933
-
233933
-    priv = this->private;
233933
-    if (!priv)
233933
-        return;
233933
-
233933
-    shd = &priv->shd;
233933
-    if (!shd->iamshd)
233933
-        return;
233933
-
233933
-    for (i = 0; i < priv->child_count; i++) {
233933
-        healer = &shd->index_healers[i];
233933
-        afr_destroy_healer_object(this, healer);
233933
 
233933
-        healer = &shd->full_healers[i];
233933
-        afr_destroy_healer_object(this, healer);
233933
-
233933
-        if (shd->statistics[i])
233933
-            eh_destroy(shd->statistics[i]);
233933
-    }
233933
-    GF_FREE(shd->index_healers);
233933
-    GF_FREE(shd->full_healers);
233933
-    GF_FREE(shd->statistics);
233933
-    if (shd->split_brain)
233933
-        eh_destroy(shd->split_brain);
233933
-}
233933
 void
233933
 fini(xlator_t *this)
233933
 {
233933
     afr_private_t *priv = NULL;
233933
 
233933
     priv = this->private;
233933
-
233933
-    afr_selfheal_daemon_fini(this);
233933
-
233933
     LOCK(&priv->lock);
233933
     if (priv->timer != NULL) {
233933
         gf_timer_call_cancel(this->ctx, priv->timer);
233933
-- 
233933
1.8.3.1
233933