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