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