diff options
author | Krishnan Parthasarathi <kparthas@redhat.com> | 2013-12-23 14:09:54 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-12-23 06:59:09 -0800 |
commit | 0a99ef20b8e8f3486f5ada8e82e4634eb9fbf62b (patch) | |
tree | a81100ca7de56ef8d1a179e5986e303f82ed194b /xlators | |
parent | b546d4fb59230eb0bba102496bca53bb0a5c86f9 (diff) |
glusterd: ignore failure to stop a stopped service.
Backport of http://review.gluster.org/6525
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 <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/6568
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 9b5371231a7..bdfa8eebcc2 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; |