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