mirror of
https://github.com/systemd/systemd.git
synced 2025-03-11 20:58:27 +03:00
pid1: log if we failed to find a watchdog device
I think we need to log at some point if the user configured a watchdog device, but no devices were found. We can't log ENOENT immediately, because the device may likely appear during boot. So wait until the end of the initial transaction and log then.
This commit is contained in:
parent
82083b0119
commit
f34a3a9b84
@ -3942,6 +3942,8 @@ static void manager_notify_finished(Manager *m) {
|
||||
|
||||
bus_manager_send_finished(m, firmware_usec, loader_usec, kernel_usec, initrd_usec, userspace_usec, total_usec);
|
||||
|
||||
watchdog_report_missing();
|
||||
|
||||
log_taint_string(m);
|
||||
}
|
||||
|
||||
|
@ -482,6 +482,23 @@ int watchdog_ping(void) {
|
||||
return watchdog_ping_now();
|
||||
}
|
||||
|
||||
void watchdog_report_missing(void) {
|
||||
/* If we failed to open the watchdog because the device doesn't exist, report why. If we successfully
|
||||
* opened a device, or opening failed for a different reason, we logged then. But ENOENT failure may
|
||||
* be transient, for example because modules being loaded or the hardware is being detected. This
|
||||
* function can be called to log after things have settled down.
|
||||
*
|
||||
* If a device was specified explicitly, raise level. */
|
||||
|
||||
if (watchdog_fd == -ENOENT)
|
||||
log_full_errno(watchdog_device ? LOG_WARNING : LOG_NOTICE,
|
||||
watchdog_fd,
|
||||
"Failed to open %swatchdog device%s%s: %m",
|
||||
watchdog_device ? "" : "any ",
|
||||
watchdog_device ? " " : "",
|
||||
strempty(watchdog_device));
|
||||
}
|
||||
|
||||
void watchdog_close(bool disarm) {
|
||||
|
||||
/* Once closed, pinging the device becomes a NOP and we request a new
|
||||
|
@ -13,6 +13,7 @@ int watchdog_setup(usec_t timeout);
|
||||
int watchdog_setup_pretimeout(usec_t usec);
|
||||
int watchdog_setup_pretimeout_governor(const char *governor);
|
||||
int watchdog_ping(void);
|
||||
void watchdog_report_missing(void);
|
||||
void watchdog_close(bool disarm);
|
||||
usec_t watchdog_runtime_wait(void);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user