cluster: RHEL56 - rgmanager: Use sysrq-b to reboot
Lon Hohberger
lon at fedoraproject.org
Wed Oct 27 20:02:52 UTC 2010
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=3f824d6438e8cfd5b3fe382eee322c49313fa6f5
Commit: 3f824d6438e8cfd5b3fe382eee322c49313fa6f5
Parent: 4614278a1c9d035299873c85b1a4afc9203d4142
Author: Lon Hohberger <lhh at redhat.com>
AuthorDate: Mon Jun 28 16:28:06 2010 -0400
Committer: Lon Hohberger <lhh at redhat.com>
CommitterDate: Wed Oct 27 15:58:26 2010 -0400
rgmanager: Use sysrq-b to reboot
This resolves an issue where the reboot() syscall
does not complete in rebooting the system, delaying
recovery if the main rgmanager process dies.
Resolves: rhbz#608397
Signed-off-by: Lon Hohberger <lhh at redhat.com>
---
rgmanager/src/daemons/watchdog.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/rgmanager/src/daemons/watchdog.c b/rgmanager/src/daemons/watchdog.c
index 9e3e9ac..abd2de1 100644
--- a/rgmanager/src/daemons/watchdog.c
+++ b/rgmanager/src/daemons/watchdog.c
@@ -22,6 +22,7 @@
#include <sys/reboot.h>
#include <stdlib.h>
#include <sys/mman.h>
+#include <fcntl.h>
#include <signals.h>
#include <clulog.h>
@@ -52,6 +53,23 @@ redirect_signals(void)
}
}
+int
+sysrq_reboot(void)
+{
+ int fd;
+
+ fd = open("/proc/sysrq-trigger", O_WRONLY|O_SYNC);
+ if (fd < 0)
+ return fd;
+
+ write(fd, "b\n", 2);
+ fsync(fd);
+ fdatasync(fd);
+ close(fd);
+
+ return 0;
+}
+
/**
return watchdog's pid, or 0 on failure
*/
@@ -93,6 +111,7 @@ watchdog_init(void)
#else
clulog(LOG_CRIT, "Watchdog: Daemon died, rebooting...\n");
sync();
+ sysrq_reboot();
reboot(RB_AUTOBOOT);
#endif
exit(255);
More information about the cluster-commits
mailing list