233933
From 022701465f3e642cdb7942995647615baa266a35 Mon Sep 17 00:00:00 2001
233933
From: Mohammed Rafi KC <rkavunga@redhat.com>
233933
Date: Thu, 11 Jul 2019 12:49:31 +0530
233933
Subject: [PATCH 245/255] Revert "shd/glusterd: Serialize shd manager to
233933
 prevent race condition"
233933
233933
This reverts commit 646292b4f73bf1b506d034b85787f794963d7196.
233933
233933
BUG: 1471742
233933
Change-Id: Ie21fbe18965d8bdea81f4276b57960a27a4db89d
233933
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
233933
Reviewed-on: https://code.engineering.redhat.com/gerrit/175954
233933
Tested-by: RHGS Build Bot <nigelb@redhat.com>
233933
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
233933
---
233933
 .../serialize-shd-manager-glusterd-restart.t       | 54 ----------------------
233933
 xlators/mgmt/glusterd/src/glusterd-shd-svc.c       | 14 ------
233933
 xlators/mgmt/glusterd/src/glusterd.c               |  1 -
233933
 xlators/mgmt/glusterd/src/glusterd.h               |  3 --
233933
 4 files changed, 72 deletions(-)
233933
 delete mode 100644 tests/bugs/glusterd/serialize-shd-manager-glusterd-restart.t
233933
233933
diff --git a/tests/bugs/glusterd/serialize-shd-manager-glusterd-restart.t b/tests/bugs/glusterd/serialize-shd-manager-glusterd-restart.t
233933
deleted file mode 100644
233933
index 3a27c2a..0000000
233933
--- a/tests/bugs/glusterd/serialize-shd-manager-glusterd-restart.t
233933
+++ /dev/null
233933
@@ -1,54 +0,0 @@
233933
-#! /bin/bash
233933
-
233933
-. $(dirname $0)/../../include.rc
233933
-. $(dirname $0)/../../cluster.rc
233933
-
233933
-function check_peers {
233933
-count=`$CLI_1 peer status | grep 'Peer in Cluster (Connected)' | wc -l`
233933
-echo $count
233933
-}
233933
-
233933
-function check_shd {
233933
-ps aux | grep $1 | grep glustershd | wc -l
233933
-}
233933
-
233933
-cleanup
233933
-
233933
-
233933
-TEST launch_cluster 6
233933
-
233933
-TESTS_EXPECTED_IN_LOOP=25
233933
-for i in $(seq 2 6); do
233933
-    hostname="H$i"
233933
-    TEST $CLI_1 peer probe ${!hostname}
233933
-done
233933
-
233933
-
233933
-EXPECT_WITHIN $PROBE_TIMEOUT 5 check_peers;
233933
-for i in $(seq 1 5); do
233933
-
233933
-    TEST $CLI_1 volume create ${V0}_$i replica 3 $H1:$B1/${V0}_$i $H2:$B2/${V0}_$i $H3:$B3/${V0}_$i $H4:$B4/${V0}_$i $H5:$B5/${V0}_$i $H6:$B6/${V0}_$i
233933
-    TEST $CLI_1 volume start ${V0}_$i force
233933
-
233933
-done
233933
-
233933
-#kill a node
233933
-TEST kill_node 3
233933
-
233933
-TEST $glusterd_3;
233933
-EXPECT_WITHIN $PROBE_TIMEOUT 5 check_peers
233933
-
233933
-EXPECT_WITHIN $PROCESS_UP_TIMEOUT 1 check_shd $H3
233933
-
233933
-for i in $(seq 1 5); do
233933
-
233933
-    TEST $CLI_1 volume stop ${V0}_$i
233933
-    TEST $CLI_1 volume delete ${V0}_$i
233933
-
233933
-done
233933
-
233933
-for i in $(seq 1 6); do
233933
-    hostname="H$i"
233933
-    EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT 0 check_shd ${!hostname}
233933
-done
233933
-cleanup
233933
diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
233933
index 75f9a07..a9eab42 100644
233933
--- a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
233933
+++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
233933
@@ -254,26 +254,14 @@ glusterd_shdsvc_manager(glusterd_svc_t *svc, void *data, int flags)
233933
 {
233933
     int ret = -1;
233933
     glusterd_volinfo_t *volinfo = NULL;
233933
-    glusterd_conf_t *conf = NULL;
233933
-    gf_boolean_t shd_restart = _gf_false;
233933
 
233933
-    conf = THIS->private;
233933
     volinfo = data;
233933
-    GF_VALIDATE_OR_GOTO("glusterd", conf, out);
233933
     GF_VALIDATE_OR_GOTO("glusterd", svc, out);
233933
     GF_VALIDATE_OR_GOTO("glusterd", volinfo, out);
233933
 
233933
     if (volinfo)
233933
         glusterd_volinfo_ref(volinfo);
233933
 
233933
-    while (conf->restart_shd) {
233933
-        synclock_unlock(&conf->big_lock);
233933
-        sleep(2);
233933
-        synclock_lock(&conf->big_lock);
233933
-    }
233933
-    conf->restart_shd = _gf_true;
233933
-    shd_restart = _gf_true;
233933
-
233933
     ret = glusterd_shdsvc_create_volfile(volinfo);
233933
     if (ret)
233933
         goto out;
233933
@@ -322,8 +310,6 @@ glusterd_shdsvc_manager(glusterd_svc_t *svc, void *data, int flags)
233933
         }
233933
     }
233933
 out:
233933
-    if (shd_restart)
233933
-        conf->restart_shd = _gf_false;
233933
     if (volinfo)
233933
         glusterd_volinfo_unref(volinfo);
233933
     if (ret)
233933
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
233933
index 6d7dd4a..c0973cb 100644
233933
--- a/xlators/mgmt/glusterd/src/glusterd.c
233933
+++ b/xlators/mgmt/glusterd/src/glusterd.c
233933
@@ -1819,7 +1819,6 @@ init(xlator_t *this)
233933
     conf->rpc = rpc;
233933
     conf->uds_rpc = uds_rpc;
233933
     conf->gfs_mgmt = &gd_brick_prog;
233933
-    conf->restart_shd = _gf_false;
233933
     this->private = conf;
233933
     /* conf->workdir and conf->rundir are smaller than PATH_MAX; gcc's
233933
      * snprintf checking will throw an error here if sprintf is used.
233933
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
233933
index 7d07d33..0fbc9dd 100644
233933
--- a/xlators/mgmt/glusterd/src/glusterd.h
233933
+++ b/xlators/mgmt/glusterd/src/glusterd.h
233933
@@ -222,9 +222,6 @@ typedef struct {
233933
     gf_atomic_t blockers;
233933
     uint32_t mgmt_v3_lock_timeout;
233933
     gf_boolean_t restart_bricks;
233933
-    gf_boolean_t restart_shd;    /* This flag prevents running two shd manager
233933
-                                    simultaneously
233933
-                                 */
233933
     pthread_mutex_t attach_lock; /* Lock can be per process or a common one */
233933
     pthread_mutex_t volume_lock; /* We release the big_lock from lot of places
233933
                                     which might lead the modification of volinfo
233933
-- 
233933
1.8.3.1
233933