From: Lidong Zhong Date: Tue, 11 Jan 2022 05:19:32 +0000 (+0800) Subject: shutdown: release the watchdog finally X-Git-Tag: v251-rc1~547 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edc6390e29d3bc1a90399ab3948ce357155edae0;p=thirdparty%2Fsystemd.git shutdown: release the watchdog finally During reboot or kexec, watchdog will be setup before systemd is replaced by systemd-shutdown binary. But while systemd-shutdown is executed, the watchdog will not really be released. Log shown as following: [ 39.371202] watchdog: watchdog0: watchdog did not stop! [ 39.383659] systemd-shutdown[1]: Syncing filesystems and block devices. [ 39.423727] systemd-shutdown[1]: Sending SIGTERM to remaining processes... [ 39.440857] systemd-journald[526]: Received SIGTERM from PID 1 (systemd-shutdow). [ 39.461047] systemd-shutdown[1]: Sending SIGKILL to remaining processes... [ 39.466736] systemd-shutdown[1]: Using hardware watchdog 'iTCO_wdt', version 0, device /dev/watchdog [ 39.467835] systemd-shutdown[1]: Unmounting file systems. [ 39.469721] [2171]: Remounting '/' read-only in with options 'attr2,inode64,logbufs=8,logbsize=32k,noquota'. [ 39.550266] systemd-shutdown[1]: All filesystems unmounted. [ 39.550274] systemd-shutdown[1]: Deactivating swaps. [ 39.550443] systemd-shutdown[1]: All swaps deactivated. [ 39.550449] systemd-shutdown[1]: Detaching loop devices. [ 39.550697] systemd-shutdown[1]: All loop devices detached. [ 39.550703] systemd-shutdown[1]: Detaching DM devices. [ 39.551269] systemd-shutdown[1]: Not all DM devices detached, 1 left. [ 39.551277] systemd-shutdown[1]: Cannot finalize remaining DM devices, continuing. [ 39.580044] systemd-shutdown[1]: Successfully changed into root pivot. [ 39.580050] systemd-shutdown[1]: Returning to initrd... [ 39.587921] watchdog: watchdog0: watchdog did not stop! [ 39.774130] dracut Warning: Break before pre-shutdown after applying fix [ 59.520379] watchdog: watchdog0: watchdog did not stop! [ 59.542286] systemd-shutdown[1]: Syncing filesystems and block devices. [ 59.583313] systemd-shutdown[1]: Sending SIGTERM to remaining processes... [ 59.600133] systemd-journald[517]: Received SIGTERM from PID 1 (systemd-shutdow). [ 59.624435] systemd-shutdown[1]: Sending SIGKILL to remaining processes... [ 59.629288] systemd-shutdown[1]: Using hardware watchdog 'iTCO_wdt', version 0, device /dev/watchdog [ 59.630468] systemd-shutdown[1]: Unmounting file systems. [ 59.632219] [2172]: Remounting '/' read-only in with options 'attr2,inode64,logbufs=8,logbsize=32k,noquota'. [ 59.727588] systemd-shutdown[1]: All filesystems unmounted. [ 59.727596] systemd-shutdown[1]: Deactivating swaps. [ 59.727719] systemd-shutdown[1]: All swaps deactivated. [ 59.727725] systemd-shutdown[1]: Detaching loop devices. [ 59.727974] systemd-shutdown[1]: All loop devices detached. [ 59.727979] systemd-shutdown[1]: Detaching DM devices. [ 59.728547] systemd-shutdown[1]: Not all DM devices detached, 1 left. [ 59.728556] systemd-shutdown[1]: Cannot finalize remaining DM devices, continuing. [ 59.758160] systemd-shutdown[1]: Successfully changed into root pivot. [ 59.758167] systemd-shutdown[1]: Returning to initrd... [ 59.950305] dracut Warning: Break before pre-shutdown --- diff --git a/src/shutdown/shutdown.c b/src/shutdown/shutdown.c index 7ad9930677d..15fd6f93d31 100644 --- a/src/shutdown/shutdown.c +++ b/src/shutdown/shutdown.c @@ -532,6 +532,7 @@ int main(int argc, char *argv[]) { } /* We're done with the watchdog. */ + watchdog_close(true); watchdog_free_device(); arguments[0] = NULL;