Messages in this thread | | | From | (Matthew S. Crocker) | Subject | PATCH: wdt.c Watchdog timer | Date | 3 Dec 1996 16:58:21 GMT |
| |
Hello all.
There is a small bug in the watchdog timer code (linux/drives/char/wdt.c). If you enable NOWATOUT and reboot the hardware counter will still be enabled and will count down. If the system doesn't come back up quick enough the watchdog board will cycle the machine again. You end up coming up part way and then rebooting with a dirty filesystem.
I have a patch (see below) which will disable the counter when the watchdog module is inserted/removed or when the kernel initializes the device on bootup (for non-module support). Patch is relative to 2.0.27 but should work with any kernel version.
To apply the patch save the patch to a file and type
cd /usr/src/linux/drivers/char patch -p0 < <patch_file_name>
-- -Matthew S Crocker "The mask, given time, comes Crocker Communications to be the face itself." -anonymous Internet Division Phone (413) 585-5164 PO BOX 710 Fax (413) 587-3352 Greenfield, MA 01302-0710 Email matthew@crocker.com =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
PATCH FOLLOWS
*** ./wdt.c.orig Tue Dec 3 15:59:01 1996 --- ./wdt.c Tue Dec 3 16:01:16 1996 *************** *** 244,254 **** --- 244,269 ---- misc_register(&temp_miscdev); #endif request_region(io, 8, "wdt501"); + + /* A soft reset (shutdown -r now) will NOT stop the counter */ + /* If the reboot takes longer than the count down time it will */ + /* reboot the machine (hard reboot). The net effect is you will */ + /* reboot twice and end up with a dirty filesystem. We need to */ + /* diable counters on module startup. */ + /* Added Tue Dec 3 15:49:49 EST 1996 matthew@crocker.com */ + + inb_p(WDT_DC); /* Disable counters */ + wdt_ctr_load(2,0); /* 0 length reset pulses now */ return 0; } void cleanup_module(void) { + /* disable the counter before we remove the module! */ + + inb_p(WDT_DC); /* Disable counters */ + wdt_ctr_load(2,0); /* 0 length reset pulses now */ + misc_deregister(&wdt_miscdev); #ifdef CONFIG_WDT_501 misc_deregister(&temp_miscdev); *************** *** 272,277 **** --- 287,302 ---- misc_register(&temp_miscdev); #endif request_region(io, 8, "wdt501"); + + /* A soft reset (shutdown -r now) will NOT stop the counter */ + /* If the reboot takes longer than the count down time it will */ + /* reboot the machine (hard reboot). The net effect is you will */ + /* reboot twice and end up with a dirty filesystem. We need to */ + /* diable counters on system startup. */ + /* Added Tue Dec 3 15:49:49 EST 1996 matthew@crocker.com */ + + inb_p(WDT_DC); /* Disable counters */ + wdt_ctr_load(2,0); /* 0 length reset pulses now */ return 0; }
| |