summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanju Rakonde <srakonde@redhat.com>2018-06-02 16:36:22 +0530
committerjiffin tony Thottan <jthottan@redhat.com>2018-07-04 04:04:00 +0000
commit31228f924b6d6645a8bd2869a8180abe74617375 (patch)
tree285b31b5c2b0f126b01d362139a3bfeb50f8a060
parentb715dfb39460d053db726c4150c5f209a1503bff (diff)
glusterd: gluster v status is showing wrong status for glustershd
When we restart the bricks, connect and disconnect events happen for glustershd. glusterd use two threads to handle disconnect and connects events from glustershd. When we restart the bricks we'll get both disconnect and connect events. So both the threads will compete for the big lock. We want disconnect event to finish before connect event. But If connect thread gets the big lock first, it sets svc->online to true, and then disconnect thread will et svc->online to false. So, glustershd will be disconnected from glusterd and wrong status is shown. After killing shd, glusterd sleeps for 1 second. To avoid the problem, If glusterd releses the lock before sleep and acquires it after sleep, disconnect thread will get a chance to handle the glusterd_svc_common_rpc_notify before other thread completes connect event. >Change-Id: Ie82e823fdfc936feb7c0ae10599297b050ee9986 >Signed-off-by: Sanju Rakonde <srakonde@redhat.com> Change-Id: Ie82e823fdfc936feb7c0ae10599297b050ee9986 fixes: bz#1582443 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c
index 8eeec40..7400daf 100644
--- a/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-proc-mgmt.c
@@ -12,6 +12,7 @@
#include <limits.h>
#include <signal.h>
+#include "glusterd.h"
#include "common-utils.h"
#include "xlator.h"
#include "logging.h"
@@ -69,13 +70,17 @@ glusterd_proc_stop (glusterd_proc_t *proc, int sig, int flags)
/* NB: Copy-paste code from glusterd_service_stop, the source may be
* removed once all daemon management use proc */
- int32_t ret = -1;
- pid_t pid = -1;
- xlator_t *this = NULL;
+ int32_t ret = -1;
+ pid_t pid = -1;
+ xlator_t *this = NULL;
+ glusterd_conf_t *conf = NULL;
this = THIS;
GF_ASSERT (this);
+ conf = this->private;
+ GF_ASSERT (conf);
+
if (!gf_is_service_running (proc->pidfile, &pid)) {
ret = 0;
gf_msg (this->name, GF_LOG_INFO, 0,
@@ -104,7 +109,9 @@ glusterd_proc_stop (glusterd_proc_t *proc, int sig, int flags)
if (flags != PROC_STOP_FORCE)
goto out;
+ synclock_unlock (&conf->big_lock);
sleep (1);
+ synclock_lock (&conf->big_lock);
if (gf_is_service_running (proc->pidfile, &pid)) {
ret = kill (pid, SIGKILL);
if (ret) {