cluster: RHEL511 - rgmanager: Forcibly remove pid file if sending SIGTERM

Ryan McCabe rmccabe at fedoraproject.org
Mon May 12 14:41:21 UTC 2014


Gitweb:        http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=a70d8ebc0abfd2110214a93e29bc5d4bf5eb9c38
Commit:        a70d8ebc0abfd2110214a93e29bc5d4bf5eb9c38
Parent:        d77a25c817c985f3200b1676c659683e3984564c
Author:        Ryan McCabe <rmccabe at redhat.com>
AuthorDate:    Mon May 12 10:40:21 2014 -0400
Committer:     Ryan McCabe <rmccabe at redhat.com>
CommitterDate: Mon May 12 10:40:21 2014 -0400

rgmanager: Forcibly remove pid file if sending SIGTERM

If a daemon is sent SIGTERM to stop it, forcibly
remove the pid file after verifying the process no longer exists. This
fixes a bug that causes future starts to fail if a new process happens
to exist with the same pid when the resource is restarted.

Resolves: rhbz#1035034

Signed-off-by: Ryan McCabe <rmccabe at redhat.com>
---
 rgmanager/src/resources/utils/ra-skelet.sh |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/rgmanager/src/resources/utils/ra-skelet.sh b/rgmanager/src/resources/utils/ra-skelet.sh
index 93a8ac3..3a502d5 100644
--- a/rgmanager/src/resources/utils/ra-skelet.sh
+++ b/rgmanager/src/resources/utils/ra-skelet.sh
@@ -96,6 +96,10 @@ stop_generic()
 		return $OCF_ERR_GENERIC
 	fi
 	
+	# If we had to send a SIGTERM, the pid file may not have been
+	# cleaned up by the daemon. Make sure it's removed so that future
+	# resource starts do not fail.
+	rm -f -- "$pid_file"
 	return 0;
 }
 


More information about the cluster-commits mailing list