summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGaurav Kumar Garg <ggarg@redhat.com>2015-04-15 11:37:22 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2015-04-30 02:43:59 -0700
commit7648c0de36c7927b588abc66734c5b94afb08c00 (patch)
treed78deb7dd4958f45c787c15f61b73a8d2ea2af0f
parent6faf89f4179c452be20f02966b9722641938599d (diff)
glusterd: do not pass volinfo in glusterd_svc_manager function
On restarting of glusterd first it will start all the bricks present in the volume then it will start all the services. During starting of all the services it may pass volinfo as a NULL. It will cause Assert failure in glusterd_bitdsvc_manager function and will cause a glusterd crash. Change-Id: Ia14cf5022da88516cdd576eb2d1e0e7b17a3782b BUG: 1207029 Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com> Reviewed-on: http://review.gluster.org/10241 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-bitd-svc.c41
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-bitrot.c29
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-scrub-svc.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-svc-helper.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c22
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h2
6 files changed, 42 insertions, 56 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-bitd-svc.c b/xlators/mgmt/glusterd/src/glusterd-bitd-svc.c
index 14c60fd5fba..8bd6d8a7276 100644
--- a/xlators/mgmt/glusterd/src/glusterd-bitd-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-bitd-svc.c
@@ -72,38 +72,29 @@ glusterd_bitdsvc_manager (glusterd_svc_t *svc, void *data, int flags)
{
int ret = 0;
xlator_t *this = NULL;
- glusterd_volinfo_t *volinfo = data;
glusterd_brickinfo_t *brickinfo = NULL;
this = THIS;
GF_ASSERT (this);
- GF_ASSERT (volinfo);
- if (glusterd_all_volumes_with_bitrot_stopped ()) {
+ if (glusterd_should_i_stop_bitd ()) {
ret = svc->stop (svc, SIGTERM);
} else {
- cds_list_for_each_entry (brickinfo, &volinfo->bricks,
- brick_list) {
- if (!glusterd_is_local_brick (this, volinfo, brickinfo))
- continue;
-
- ret = glusterd_bitdsvc_create_volfile ();
- if (ret)
- goto out;
-
- ret = svc->stop (svc, SIGKILL);
- if (ret)
- goto out;
-
- ret = svc->start (svc, flags);
- if (ret)
- goto out;
-
- ret = glusterd_conn_connect (&(svc->conn));
- if (ret)
- goto out;
- break;
- }
+ ret = glusterd_bitdsvc_create_volfile ();
+ if (ret)
+ goto out;
+
+ ret = svc->stop (svc, SIGKILL);
+ if (ret)
+ goto out;
+
+ ret = svc->start (svc, flags);
+ if (ret)
+ goto out;
+
+ ret = glusterd_conn_connect (&(svc->conn));
+ if (ret)
+ goto out;
}
out:
diff --git a/xlators/mgmt/glusterd/src/glusterd-bitrot.c b/xlators/mgmt/glusterd/src/glusterd-bitrot.c
index 55a5e3ac750..ae654a0aa87 100644
--- a/xlators/mgmt/glusterd/src/glusterd-bitrot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-bitrot.c
@@ -312,11 +312,16 @@ out:
}
gf_boolean_t
-glusterd_all_volumes_with_bitrot_stopped ()
+glusterd_should_i_stop_bitd ()
{
- glusterd_conf_t *conf = THIS->private;
- glusterd_volinfo_t *volinfo = NULL;
- gf_boolean_t stopped = _gf_true;
+ glusterd_conf_t *conf = THIS->private;
+ glusterd_volinfo_t *volinfo = NULL;
+ gf_boolean_t stopped = _gf_true;
+ glusterd_brickinfo_t *brickinfo = NULL;
+ xlator_t *this = NULL;
+
+ this = THIS;
+ GF_ASSERT (this);
cds_list_for_each_entry (volinfo, &conf->volumes, vol_list) {
if (!glusterd_is_bitrot_enabled (volinfo))
@@ -324,7 +329,15 @@ glusterd_all_volumes_with_bitrot_stopped ()
else if (volinfo->status != GLUSTERD_STATUS_STARTED)
continue;
else {
- stopped = _gf_false;
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks,
+ brick_list) {
+ if (!glusterd_is_local_brick (this, volinfo,
+ brickinfo))
+ continue;
+ stopped = _gf_false;
+ break;
+ }
+
break;
}
}
@@ -333,7 +346,7 @@ glusterd_all_volumes_with_bitrot_stopped ()
}
static int
-glusterd_manage_bitrot (int opcode, glusterd_volinfo_t *volinfo)
+glusterd_manage_bitrot (int opcode)
{
int ret = -1;
xlator_t *this = NULL;
@@ -349,7 +362,7 @@ glusterd_manage_bitrot (int opcode, glusterd_volinfo_t *volinfo)
case GF_BITROT_OPTION_TYPE_ENABLE:
case GF_BITROT_OPTION_TYPE_DISABLE:
ret = priv->bitd_svc.manager (&(priv->bitd_svc),
- volinfo, PROC_START_NO_WAIT);
+ NULL, PROC_START_NO_WAIT);
if (ret)
break;
ret = priv->scrub_svc.manager (&(priv->scrub_svc), NULL,
@@ -445,7 +458,7 @@ glusterd_op_bitrot (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
goto out;
}
- ret = glusterd_manage_bitrot (type, volinfo);
+ ret = glusterd_manage_bitrot (type);
if (ret)
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-scrub-svc.c b/xlators/mgmt/glusterd/src/glusterd-scrub-svc.c
index bd1ed390f46..9b72053e89c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-scrub-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-scrub-svc.c
@@ -74,7 +74,7 @@ glusterd_scrubsvc_manager (glusterd_svc_t *svc, void *data, int flags)
{
int ret = -EINVAL;
- if (glusterd_all_volumes_with_bitrot_stopped ()) {
+ if (glusterd_should_i_stop_bitd ()) {
ret = svc->stop (svc, SIGTERM);
} else {
ret = glusterd_scrubsvc_create_volfile ();
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
index b4280dcb9ba..8ee715f1a94 100644
--- a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
@@ -136,7 +136,7 @@ glusterd_svcs_manager (glusterd_volinfo_t *volinfo)
if (ret)
goto out;
- ret = conf->bitd_svc.manager (&(conf->bitd_svc), volinfo,
+ ret = conf->bitd_svc.manager (&(conf->bitd_svc), NULL,
PROC_START_NO_WAIT);
if (ret == -EINVAL)
ret = 0;
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 3025cd6f118..ce55a9d3490 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -3853,9 +3853,6 @@ glusterd_compare_friend_data (dict_t *peer_data, int32_t *status,
int32_t count = 0;
int i = 1;
gf_boolean_t update = _gf_false;
- gf_boolean_t stale_nfs = _gf_false;
- gf_boolean_t stale_shd = _gf_false;
- gf_boolean_t stale_qd = _gf_false;
xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
@@ -3895,26 +3892,11 @@ glusterd_compare_friend_data (dict_t *peer_data, int32_t *status,
}
if (update) {
- if (glusterd_proc_is_running (&(priv->nfs_svc.proc)))
- stale_nfs = _gf_true;
- if (glusterd_proc_is_running (&(priv->shd_svc.proc)))
- stale_shd = _gf_true;
- if (glusterd_proc_is_running (&(priv->quotad_svc.proc)))
- stale_qd = _gf_true;
ret = glusterd_import_friend_volumes (peer_data);
if (ret)
goto out;
- if (_gf_false == glusterd_are_all_volumes_stopped ()) {
- ret = glusterd_svcs_manager (NULL);
- } else {
- if (stale_nfs)
- priv->nfs_svc.stop (&(priv->nfs_svc), SIGKILL);
- if (stale_shd)
- priv->shd_svc.stop (&(priv->shd_svc), SIGTERM);
- if (stale_qd)
- priv->quotad_svc.stop (&(priv->quotad_svc),
- SIGTERM);
- }
+
+ glusterd_svcs_manager (NULL);
}
out:
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 1653549d2b0..e70276d0506 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -1110,6 +1110,6 @@ int32_t
glusterd_handle_snap_limit (dict_t *dict, dict_t *rsp_dict);
gf_boolean_t
-glusterd_all_volumes_with_bitrot_stopped ();
+glusterd_should_i_stop_bitd ();
#endif