From 709d9247bb467b801814637bd181bc7cddd36cb5 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Tue, 17 Dec 2013 11:43:22 +0530 Subject: glusterd: ignore failure to stop a stopped service. kill(2) returns -1 with errno set to ESRCH when the pid of the process being killed doesn't exist. Failing glusterd_brick_stop on a stopped brick could result in volume-stop failing, in commit phase. This fix prevents that from happening. Change-Id: I00f46fa06e489a671efbb8e4119f545f8ccea329 BUG: 1038051 Signed-off-by: Krishnan Parthasarathi Reviewed-on: http://review.gluster.org/6525 Reviewed-by: Vijaikumar Mallikarjuna Reviewed-by: Kaushal M Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-utils.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index b05c39c3e..6614f98db 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -1142,6 +1142,18 @@ glusterd_service_stop (const char *service, char *pidfile, int sig, "%d", service, pid); ret = kill (pid, sig); + if (ret) { + switch (errno) { + case ESRCH: + gf_log (this->name, GF_LOG_DEBUG, "%s is already stopped", + service); + ret = 0; + break; + default: + gf_log (this->name, GF_LOG_ERROR, "Failed to kill %s: %s", + service, strerror (errno)); + } + } if (!force_kill) goto out; -- cgit