From e9ec61c9fc264c813bb9ed06891e2294870a50bc Mon Sep 17 00:00:00 2001 From: Mohammed Rafi KC Date: Wed, 22 May 2019 13:32:23 +0530 Subject: glusterd/svc: glusterd_svcs_stop should call individual wrapper function glusterd_svcs_stop should call individual wrapper function to stop a daemon rather than calling glusterd_svc_stop. For example for shd, it should call glusterd_shdsvc_stop instead of calling basic API function to stop. Because the individual functions for each daemon could be doing some specific operation in their wrapper function. Change-Id: Ie6d40590251ad470ef3901d1141ab7b22c3498f5 fixes: bz#1712741 Signed-off-by: Mohammed Rafi KC --- xlators/mgmt/glusterd/src/glusterd-shd-svc.c | 12 ++++++++++-- xlators/mgmt/glusterd/src/glusterd-svc-helper.c | 10 +++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c index 598c0823586..ce68a0f07c3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c +++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c @@ -656,10 +656,18 @@ glusterd_shdsvc_stop(glusterd_svc_t *svc, int sig) int pid = -1; conf = THIS->private; + GF_VALIDATE_OR_GOTO("glusterd", conf, out); GF_VALIDATE_OR_GOTO("glusterd", svc, out); svc_proc = svc->svc_proc; - GF_VALIDATE_OR_GOTO("glusterd", svc_proc, out); - GF_VALIDATE_OR_GOTO("glusterd", conf, out); + if (!svc_proc) { + /* + * This can happen when stop was called on a volume that is not shd + * compatible. + */ + gf_msg_debug("glusterd", 0, "svc_proc is null, ie shd already stopped"); + ret = 0; + goto out; + } /* Get volinfo->shd from svc object */ shd = cds_list_entry(svc, glusterd_shdsvc_t, svc); diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c index 97a0d646273..f53bd417e05 100644 --- a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c +++ b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c @@ -84,25 +84,25 @@ glusterd_svcs_stop(glusterd_volinfo_t *volinfo) priv = this->private; GF_ASSERT(priv); - ret = glusterd_svc_stop(&(priv->nfs_svc), SIGKILL); + ret = priv->nfs_svc.stop(&(priv->nfs_svc), SIGKILL); if (ret) goto out; - ret = glusterd_svc_stop(&(priv->quotad_svc), SIGTERM); + ret = priv->quotad_svc.stop(&(priv->quotad_svc), SIGTERM); if (ret) goto out; if (volinfo) { - ret = glusterd_svc_stop(&(volinfo->shd.svc), PROC_START_NO_WAIT); + ret = volinfo->shd.svc.stop(&(volinfo->shd.svc), SIGTERM); if (ret) goto out; } - ret = glusterd_svc_stop(&(priv->bitd_svc), SIGTERM); + ret = priv->bitd_svc.stop(&(priv->bitd_svc), SIGTERM); if (ret) goto out; - ret = glusterd_svc_stop(&(priv->scrub_svc), SIGTERM); + ret = priv->scrub_svc.stop(&(priv->scrub_svc), SIGTERM); out: return ret; } -- cgit