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