summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShreyas Siravara <sshreyas@fb.com>2017-04-05 13:23:13 -0700
committerShreyas Siravara <sshreyas@fb.com>2017-09-08 00:17:35 +0000
commit868d082bd4384aab6b1b5ede2435c10a89ab8aa2 (patch)
tree2f62ed4bd2cdd8d4fbae5158bf713bfbf441589f
parent5c2015a5d84f176d68d704c21602d7131ca7dfda (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. - This is a port of D4837916 to 3.8 Change-Id: Ic96952a8d31927446f648830ede6ccd82512663f 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>
-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 4224ecb2dae..27bf68d50e1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1654,10 +1654,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;
+ }
}
}