summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorShreyas Siravara <sshreyas@fb.com>2017-04-05 13:23:13 -0700
committerAtin Mukherjee <amukherj@redhat.com>2017-12-08 05:30:02 +0000
commit97a97bab57873083d5b49f636fd0ccbe94a310e3 (patch)
treef23d3eaee4881698fe9089f8a4aef7fa5cc5d841 /xlators/mgmt/glusterd/src/glusterd-utils.c
parentfaa06328fe58ca85cc3c1c849d293df81efdb9c4 (diff)
glusterd: Allow volume stop to succeed if certain processes are already dead
Summary: - Sometimes a the process that glusterd is trying to kill is already dead. - In that case, if it can't find the pid, it should just continue on and not fail the entire operation. Change-Id: Ic96952a8d31927446f648830ede6ccd82512663f BUG: 1522968 Reviewed-on: https://review.gluster.org/18234 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Shreyas Siravara <sshreyas@fb.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Signed-off-by: Ana M. Neri <amnerip@fb.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 38ba20b8fb2..aa8b4e4ede8 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1814,10 +1814,20 @@ glusterd_service_stop_nolock (const char *service, char *pidfile, int sig,
if (kill(pid, 0) == 0) {
ret = kill (pid, SIGKILL);
if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, errno,
- GD_MSG_PID_KILL_FAIL, "Unable to kill pid:%d, "
- "reason:%s", pid, strerror(errno));
- goto out;
+ /* Process is already dead, don't fail */
+ if (errno == ESRCH) {
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_PID_KILL_FAIL,
+ "Unable to find pid:%d, "
+ "must be dead already. Ignoring.", pid);
+ ret = 0;
+ } else {
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_PID_KILL_FAIL,
+ "Unable to kill pid:%d, "
+ "reason:%s", pid, strerror(errno));
+ goto out;
+ }
}
}