From 764bb0c1e69294a16af22c82a7e788976a0ff797 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Thu, 9 May 2013 18:07:59 +0530 Subject: glusterd: Start bricks on glusterd startup, only once The restarting of bricks has been deffered until the cluster 'stabilizes' itself volumes' view. Since glusterd_spawn_daemons is executed everytime a peer 'joins' the cluster, it may inadvertently restart bricks that were taken offline for say, maintenance purposes. This fix avoids that. Change-Id: Ic2a0a9657eb95c82d03cf5eb893322cf55c44eba BUG: 960190 Signed-off-by: Krishnan Parthasarathi Reviewed-on: http://review.gluster.org/5022 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-sm.c | 2 +- xlators/mgmt/glusterd/src/glusterd-utils.c | 6 ++++-- xlators/mgmt/glusterd/src/glusterd.c | 3 +-- xlators/mgmt/glusterd/src/glusterd.h | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c index a82ca2e176f..c2bf493004a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-sm.c @@ -1091,7 +1091,7 @@ out: * the functions spawn process(es) only if they are not started yet. * * */ - glusterd_spawn_daemons ((void*) _gf_false); + glusterd_spawn_daemons (NULL); glusterd_do_quorum_action (); } return ret; diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 2153a43df97..6ff3c80924d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -2398,10 +2398,12 @@ int glusterd_spawn_daemons (void *opaque) { glusterd_conf_t *conf = THIS->private; - gf_boolean_t start_bricks = (long) opaque; + gf_boolean_t start_bricks = !conf->restart_done; - if (start_bricks) + if (start_bricks) { glusterd_restart_bricks (conf); + conf->restart_done = _gf_true; + } glusterd_restart_gsyncds (conf); glusterd_restart_rebalance (conf); return 0; diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index e3f671f086d..b663bb9380d 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -1157,8 +1157,7 @@ init (xlator_t *this) * time (this) glusterd was up.*/ if (list_empty (&conf->peers)) { - glusterd_launch_synctask (glusterd_spawn_daemons, - (void*) _gf_true); + glusterd_launch_synctask (glusterd_spawn_daemons, NULL); } ret = glusterd_options_init (this); if (ret < 0) diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h index a4f2d23ac2c..5198ff41d5f 100644 --- a/xlators/mgmt/glusterd/src/glusterd.h +++ b/xlators/mgmt/glusterd/src/glusterd.h @@ -153,6 +153,7 @@ typedef struct { gf_boolean_t pending_quorum_action; dict_t *opts; synclock_t big_lock; + gf_boolean_t restart_done; } glusterd_conf_t; -- cgit