From 97a97bab57873083d5b49f636fd0ccbe94a310e3 Mon Sep 17 00:00:00 2001 From: Shreyas Siravara Date: Wed, 5 Apr 2017 13:23:13 -0700 Subject: 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 Reviewed-by: Shreyas Siravara CentOS-regression: Gluster Build System Signed-off-by: Ana M. Neri --- xlators/mgmt/glusterd/src/glusterd-utils.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'xlators') 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; + } } } -- cgit