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