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