|
|
673c78 |
From 006aca565d4c8565baf05296b8e65ca4d5f203d3 Mon Sep 17 00:00:00 2001
|
|
|
673c78 |
From: Hans de Goede <hdegoede@redhat.com>
|
|
|
673c78 |
Date: Fri, 30 Jul 2021 13:22:54 +0200
|
|
|
673c78 |
Subject: wdctl: Workaround reported boot-status bits not being present in
|
|
|
673c78 |
wd->ident.options
|
|
|
673c78 |
|
|
|
673c78 |
Some watchdog drivers are capable of reporting WDIOF_CARDRESET in their
|
|
|
673c78 |
bootstatus, but they do not advertise this in the options field
|
|
|
673c78 |
returned by the WDIOC_GETSUPPORT ioctl.
|
|
|
673c78 |
|
|
|
673c78 |
This causes wdctl to not print the CARDRESET flag on these devices,
|
|
|
673c78 |
even when the reset was caused by the watchdog and this is being
|
|
|
673c78 |
reported in the WDIOC_GETBOOTSTATUS return.
|
|
|
673c78 |
|
|
|
673c78 |
Add a workaround by or-ing any bits which are set in the status and
|
|
|
673c78 |
bstatus returns into wd->ident.options so that reported flags will
|
|
|
673c78 |
get printend independent of them being advertised as supported in
|
|
|
673c78 |
wd->ident.options.
|
|
|
673c78 |
|
|
|
673c78 |
This will make wdctl print a CARDRESET line when the system was
|
|
|
673c78 |
actually reset by the watchdog while omitting it when it was not
|
|
|
673c78 |
reset by the watchdog. At least on drivers which have the
|
|
|
673c78 |
CARDRESET is missing from info.options problem. On other drivers
|
|
|
673c78 |
the CARDRESET line will always be printend, but the actual reported
|
|
|
673c78 |
value will change.
|
|
|
673c78 |
|
|
|
673c78 |
Upstream: http://github.com/util-linux/util-linux/commit/b1b0259fe42aad1bf0997ce1c03a020ce59e38ab
|
|
|
673c78 |
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2057046
|
|
|
673c78 |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
673c78 |
---
|
|
|
673c78 |
sys-utils/wdctl.c | 7 +++++++
|
|
|
673c78 |
1 file changed, 7 insertions(+)
|
|
|
673c78 |
|
|
|
673c78 |
diff --git a/sys-utils/wdctl.c b/sys-utils/wdctl.c
|
|
|
673c78 |
index 8de5d5a2d..6b9affa0a 100644
|
|
|
673c78 |
--- a/sys-utils/wdctl.c
|
|
|
673c78 |
+++ b/sys-utils/wdctl.c
|
|
|
673c78 |
@@ -419,6 +419,13 @@ static int read_watchdog_from_device(struct wd_device *wd)
|
|
|
673c78 |
ioctl(fd, WDIOC_GETSTATUS, &wd->status);
|
|
|
673c78 |
ioctl(fd, WDIOC_GETBOOTSTATUS, &wd->bstatus);
|
|
|
673c78 |
|
|
|
673c78 |
+ /*
|
|
|
673c78 |
+ * Sometimes supported options like WDIOF_CARDRESET are missing from
|
|
|
673c78 |
+ * ident.options, add anything set in status/bstatus to ident.options.
|
|
|
673c78 |
+ */
|
|
|
673c78 |
+ wd->ident.options |= wd->status;
|
|
|
673c78 |
+ wd->ident.options |= wd->bstatus;
|
|
|
673c78 |
+
|
|
|
673c78 |
if (ioctl(fd, WDIOC_GETTIMEOUT, &wd->timeout) >= 0)
|
|
|
673c78 |
wd->has_timeout = 1;
|
|
|
673c78 |
if (ioctl(fd, WDIOC_GETPRETIMEOUT, &wd->pretimeout) >= 0)
|
|
|
673c78 |
--
|
|
|
673c78 |
2.34.1
|
|
|
673c78 |
|