14f8ab
From f6d967cd70ff41a0f93c54d50128c468e9d5dea9 Mon Sep 17 00:00:00 2001
14f8ab
From: Mohammed Rafi KC <rkavunga@redhat.com>
14f8ab
Date: Thu, 11 Jul 2019 12:49:21 +0530
14f8ab
Subject: [PATCH 244/255] Revert "ec/shd: Cleanup self heal daemon resources
14f8ab
 during ec fini"
14f8ab
14f8ab
This reverts commit edc238e40060773f5f5fd59fcdad8ae27d65749f.
14f8ab
14f8ab
BUG: 1471742
14f8ab
Change-Id: If6cb5941b964f005454a21a67938b354ef1a2037
14f8ab
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
14f8ab
Reviewed-on: https://code.engineering.redhat.com/gerrit/175953
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          |  2 -
14f8ab
 xlators/cluster/afr/src/afr-self-heald.c |  5 ---
14f8ab
 xlators/cluster/ec/src/ec-heald.c        | 77 +++++---------------------------
14f8ab
 xlators/cluster/ec/src/ec-heald.h        |  3 --
14f8ab
 xlators/cluster/ec/src/ec-messages.h     |  3 +-
14f8ab
 xlators/cluster/ec/src/ec.c              | 47 -------------------
14f8ab
 6 files changed, 13 insertions(+), 124 deletions(-)
14f8ab
14f8ab
diff --git a/libglusterfs/src/syncop-utils.c b/libglusterfs/src/syncop-utils.c
14f8ab
index 4167db4..b842142 100644
14f8ab
--- a/libglusterfs/src/syncop-utils.c
14f8ab
+++ b/libglusterfs/src/syncop-utils.c
14f8ab
@@ -354,8 +354,6 @@ syncop_mt_dir_scan(call_frame_t *frame, xlator_t *subvol, loc_t *loc, int pid,
14f8ab
 
14f8ab
     if (frame) {
14f8ab
         this = frame->this;
14f8ab
-    } else {
14f8ab
-        this = THIS;
14f8ab
     }
14f8ab
 
14f8ab
     /*For this functionality to be implemented in general, we need
14f8ab
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
14f8ab
index 522fe5d..8bc4720 100644
14f8ab
--- a/xlators/cluster/afr/src/afr-self-heald.c
14f8ab
+++ b/xlators/cluster/afr/src/afr-self-heald.c
14f8ab
@@ -524,11 +524,6 @@ afr_shd_full_heal(xlator_t *subvol, gf_dirent_t *entry, loc_t *parent,
14f8ab
     afr_private_t *priv = NULL;
14f8ab
 
14f8ab
     priv = this->private;
14f8ab
-
14f8ab
-    if (this->cleanup_starting) {
14f8ab
-        return -ENOTCONN;
14f8ab
-    }
14f8ab
-
14f8ab
     if (!priv->shd.enabled)
14f8ab
         return -EBUSY;
14f8ab
 
14f8ab
diff --git a/xlators/cluster/ec/src/ec-heald.c b/xlators/cluster/ec/src/ec-heald.c
14f8ab
index edf5e11..cba111a 100644
14f8ab
--- a/xlators/cluster/ec/src/ec-heald.c
14f8ab
+++ b/xlators/cluster/ec/src/ec-heald.c
14f8ab
@@ -71,11 +71,6 @@ disabled_loop:
14f8ab
             break;
14f8ab
     }
14f8ab
 
14f8ab
-    if (ec->shutdown) {
14f8ab
-        healer->running = _gf_false;
14f8ab
-        return -1;
14f8ab
-    }
14f8ab
-
14f8ab
     ret = healer->rerun;
14f8ab
     healer->rerun = 0;
14f8ab
 
14f8ab
@@ -246,11 +241,9 @@ ec_shd_index_sweep(struct subvol_healer *healer)
14f8ab
         goto out;
14f8ab
     }
14f8ab
 
14f8ab
-    _mask_cancellation();
14f8ab
     ret = syncop_mt_dir_scan(NULL, subvol, &loc, GF_CLIENT_PID_SELF_HEALD,
14f8ab
                              healer, ec_shd_index_heal, xdata,
14f8ab
                              ec->shd.max_threads, ec->shd.wait_qlength);
14f8ab
-    _unmask_cancellation();
14f8ab
 out:
14f8ab
     if (xdata)
14f8ab
         dict_unref(xdata);
14f8ab
@@ -270,11 +263,6 @@ ec_shd_full_heal(xlator_t *subvol, gf_dirent_t *entry, loc_t *parent,
14f8ab
     int ret = 0;
14f8ab
 
14f8ab
     ec = this->private;
14f8ab
-
14f8ab
-    if (this->cleanup_starting) {
14f8ab
-        return -ENOTCONN;
14f8ab
-    }
14f8ab
-
14f8ab
     if (ec->xl_up_count <= ec->fragments) {
14f8ab
         return -ENOTCONN;
14f8ab
     }
14f8ab
@@ -317,15 +305,11 @@ ec_shd_full_sweep(struct subvol_healer *healer, inode_t *inode)
14f8ab
 {
14f8ab
     ec_t *ec = NULL;
14f8ab
     loc_t loc = {0};
14f8ab
-    int ret = -1;
14f8ab
 
14f8ab
     ec = healer->this->private;
14f8ab
     loc.inode = inode;
14f8ab
-    _mask_cancellation();
14f8ab
-    ret = syncop_ftw(ec->xl_list[healer->subvol], &loc,
14f8ab
-                     GF_CLIENT_PID_SELF_HEALD, healer, ec_shd_full_heal);
14f8ab
-    _unmask_cancellation();
14f8ab
-    return ret;
14f8ab
+    return syncop_ftw(ec->xl_list[healer->subvol], &loc,
14f8ab
+                      GF_CLIENT_PID_SELF_HEALD, healer, ec_shd_full_heal);
14f8ab
 }
14f8ab
 
14f8ab
 void *
14f8ab
@@ -333,16 +317,13 @@ ec_shd_index_healer(void *data)
14f8ab
 {
14f8ab
     struct subvol_healer *healer = NULL;
14f8ab
     xlator_t *this = NULL;
14f8ab
-    int run = 0;
14f8ab
 
14f8ab
     healer = data;
14f8ab
     THIS = this = healer->this;
14f8ab
     ec_t *ec = this->private;
14f8ab
 
14f8ab
     for (;;) {
14f8ab
-        run = ec_shd_healer_wait(healer);
14f8ab
-        if (run == -1)
14f8ab
-            break;
14f8ab
+        ec_shd_healer_wait(healer);
14f8ab
 
14f8ab
         if (ec->xl_up_count > ec->fragments) {
14f8ab
             gf_msg_debug(this->name, 0, "starting index sweep on subvol %s",
14f8ab
@@ -371,12 +352,16 @@ ec_shd_full_healer(void *data)
14f8ab
 
14f8ab
     rootloc.inode = this->itable->root;
14f8ab
     for (;;) {
14f8ab
-        run = ec_shd_healer_wait(healer);
14f8ab
-        if (run < 0) {
14f8ab
-            break;
14f8ab
-        } else if (run == 0) {
14f8ab
-            continue;
14f8ab
+        pthread_mutex_lock(&healer->mutex);
14f8ab
+        {
14f8ab
+            run = __ec_shd_healer_wait(healer);
14f8ab
+            if (!run)
14f8ab
+                healer->running = _gf_false;
14f8ab
         }
14f8ab
+        pthread_mutex_unlock(&healer->mutex);
14f8ab
+
14f8ab
+        if (!run)
14f8ab
+            break;
14f8ab
 
14f8ab
         if (ec->xl_up_count > ec->fragments) {
14f8ab
             gf_msg(this->name, GF_LOG_INFO, 0, EC_MSG_FULL_SWEEP_START,
14f8ab
@@ -577,41 +562,3 @@ out:
14f8ab
     dict_del(output, this->name);
14f8ab
     return ret;
14f8ab
 }
14f8ab
-
14f8ab
-void
14f8ab
-ec_destroy_healer_object(xlator_t *this, struct subvol_healer *healer)
14f8ab
-{
14f8ab
-    if (!healer)
14f8ab
-        return;
14f8ab
-
14f8ab
-    pthread_cond_destroy(&healer->cond);
14f8ab
-    pthread_mutex_destroy(&healer->mutex);
14f8ab
-}
14f8ab
-
14f8ab
-void
14f8ab
-ec_selfheal_daemon_fini(xlator_t *this)
14f8ab
-{
14f8ab
-    struct subvol_healer *healer = NULL;
14f8ab
-    ec_self_heald_t *shd = NULL;
14f8ab
-    ec_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->nodes; i++) {
14f8ab
-        healer = &shd->index_healers[i];
14f8ab
-        ec_destroy_healer_object(this, healer);
14f8ab
-
14f8ab
-        healer = &shd->full_healers[i];
14f8ab
-        ec_destroy_healer_object(this, healer);
14f8ab
-    }
14f8ab
-
14f8ab
-    GF_FREE(shd->index_healers);
14f8ab
-    GF_FREE(shd->full_healers);
14f8ab
-}
14f8ab
diff --git a/xlators/cluster/ec/src/ec-heald.h b/xlators/cluster/ec/src/ec-heald.h
14f8ab
index 8184cf4..2eda2a7 100644
14f8ab
--- a/xlators/cluster/ec/src/ec-heald.h
14f8ab
+++ b/xlators/cluster/ec/src/ec-heald.h
14f8ab
@@ -24,7 +24,4 @@ ec_selfheal_daemon_init(xlator_t *this);
14f8ab
 void
14f8ab
 ec_shd_index_healer_wake(ec_t *ec);
14f8ab
 
14f8ab
-void
14f8ab
-ec_selfheal_daemon_fini(xlator_t *this);
14f8ab
-
14f8ab
 #endif /* __EC_HEALD_H__ */
14f8ab
diff --git a/xlators/cluster/ec/src/ec-messages.h b/xlators/cluster/ec/src/ec-messages.h
14f8ab
index ce299bb..7c28808 100644
14f8ab
--- a/xlators/cluster/ec/src/ec-messages.h
14f8ab
+++ b/xlators/cluster/ec/src/ec-messages.h
14f8ab
@@ -55,7 +55,6 @@ GLFS_MSGID(EC, EC_MSG_INVALID_CONFIG, EC_MSG_HEAL_FAIL,
14f8ab
            EC_MSG_CONFIG_XATTR_INVALID, EC_MSG_EXTENSION, EC_MSG_EXTENSION_NONE,
14f8ab
            EC_MSG_EXTENSION_UNKNOWN, EC_MSG_EXTENSION_UNSUPPORTED,
14f8ab
            EC_MSG_EXTENSION_FAILED, EC_MSG_NO_GF, EC_MSG_MATRIX_FAILED,
14f8ab
-           EC_MSG_DYN_CREATE_FAILED, EC_MSG_DYN_CODEGEN_FAILED,
14f8ab
-           EC_MSG_THREAD_CLEANUP_FAILED);
14f8ab
+           EC_MSG_DYN_CREATE_FAILED, EC_MSG_DYN_CODEGEN_FAILED);
14f8ab
 
14f8ab
 #endif /* !_EC_MESSAGES_H_ */
14f8ab
diff --git a/xlators/cluster/ec/src/ec.c b/xlators/cluster/ec/src/ec.c
14f8ab
index 264582a..3c8013e 100644
14f8ab
--- a/xlators/cluster/ec/src/ec.c
14f8ab
+++ b/xlators/cluster/ec/src/ec.c
14f8ab
@@ -429,51 +429,6 @@ ec_disable_delays(ec_t *ec)
14f8ab
 }
14f8ab
 
14f8ab
 void
14f8ab
-ec_cleanup_healer_object(ec_t *ec)
14f8ab
-{
14f8ab
-    struct subvol_healer *healer = NULL;
14f8ab
-    ec_self_heald_t *shd = NULL;
14f8ab
-    void *res = NULL;
14f8ab
-    int i = 0;
14f8ab
-    gf_boolean_t is_join = _gf_false;
14f8ab
-
14f8ab
-    shd = &ec->shd;
14f8ab
-    if (!shd->iamshd)
14f8ab
-        return;
14f8ab
-
14f8ab
-    for (i = 0; i < ec->nodes; i++) {
14f8ab
-        healer = &shd->index_healers[i];
14f8ab
-        pthread_mutex_lock(&healer->mutex);
14f8ab
-        {
14f8ab
-            healer->rerun = 1;
14f8ab
-            if (healer->running) {
14f8ab
-                pthread_cond_signal(&healer->cond);
14f8ab
-                is_join = _gf_true;
14f8ab
-            }
14f8ab
-        }
14f8ab
-        pthread_mutex_unlock(&healer->mutex);
14f8ab
-        if (is_join) {
14f8ab
-            pthread_join(healer->thread, &res;;
14f8ab
-            is_join = _gf_false;
14f8ab
-        }
14f8ab
-
14f8ab
-        healer = &shd->full_healers[i];
14f8ab
-        pthread_mutex_lock(&healer->mutex);
14f8ab
-        {
14f8ab
-            healer->rerun = 1;
14f8ab
-            if (healer->running) {
14f8ab
-                pthread_cond_signal(&healer->cond);
14f8ab
-                is_join = _gf_true;
14f8ab
-            }
14f8ab
-        }
14f8ab
-        pthread_mutex_unlock(&healer->mutex);
14f8ab
-        if (is_join) {
14f8ab
-            pthread_join(healer->thread, &res;;
14f8ab
-            is_join = _gf_false;
14f8ab
-        }
14f8ab
-    }
14f8ab
-}
14f8ab
-void
14f8ab
 ec_pending_fops_completed(ec_t *ec)
14f8ab
 {
14f8ab
     if (ec->shutdown) {
14f8ab
@@ -589,7 +544,6 @@ ec_notify(xlator_t *this, int32_t event, void *data, void *data2)
14f8ab
         /* If there aren't pending fops running after we have waken up
14f8ab
          * them, we immediately propagate the notification. */
14f8ab
         propagate = ec_disable_delays(ec);
14f8ab
-        ec_cleanup_healer_object(ec);
14f8ab
         goto unlock;
14f8ab
     }
14f8ab
 
14f8ab
@@ -805,7 +759,6 @@ failed:
14f8ab
 void
14f8ab
 fini(xlator_t *this)
14f8ab
 {
14f8ab
-    ec_selfheal_daemon_fini(this);
14f8ab
     __ec_destroy_private(this);
14f8ab
 }
14f8ab
 
14f8ab
-- 
14f8ab
1.8.3.1
14f8ab