summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2010-09-17 13:36:12 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-17 23:34:56 -0700
commit1f7610608c4888fecc416a46b52d35c791a5116f (patch)
treea185db8596cd5634c67f24c921ff987c701fa46a /xlators/mgmt/glusterd/src/glusterd-op-sm.c
parentdbb2b3764c6f9cfeaeacd868e3167210017ba848 (diff)
glusterd: refactor service termination
Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1570 (geosync related changes) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1570
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c37
1 files changed, 1 insertions, 36 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 4d5fb05e162..ce05c92eae2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -1876,10 +1876,7 @@ rb_kill_destination_brick (glusterd_volinfo_t *volinfo,
glusterd_brickinfo_t *dst_brickinfo)
{
glusterd_conf_t *priv = NULL;
- int ret = -1;
char pidfile[PATH_MAX] = {0,};
- pid_t pid = -1;
- FILE *file = NULL;
priv = THIS->private;
@@ -1887,39 +1884,7 @@ rb_kill_destination_brick (glusterd_volinfo_t *volinfo,
priv->workdir, volinfo->volname,
RB_DSTBRICK_PIDFILE);
- file = fopen (pidfile, "r+");
- if (!file) {
- gf_log ("", GF_LOG_ERROR, "Unable to open pidfile: %s",
- pidfile);
- ret = -1;
- goto out;
- }
-
- ret = fscanf (file, "%d", &pid);
- if (ret <= 0) {
- gf_log ("", GF_LOG_ERROR, "Unable to read pidfile: %s",
- pidfile);
- ret = -1;
- goto out;
- }
-
- fclose (file);
- file = NULL;
-
- gf_log ("", GF_LOG_NORMAL, "Stopping glusterfs running in pid: %d",
- pid);
-
- ret = kill (pid, SIGQUIT);
-
- if (ret) {
- gf_log ("", GF_LOG_ERROR, "Unable to kill pid %d", pid);
- goto out;
- }
-
- ret = 0;
-
-out:
- return ret;
+ return glusterd_service_stop ("brick", pidfile, SIGQUIT, _gf_true);
}
static int