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