Subject: root fs timestamp does not get updated (#130) Index: sys/ufs_subr.c 2.11BSD Description: The root filesystem's timestamp can fall seriously short of the real time of day. If a powerfail occurs (and battery backup is present) and a autoreboot is done, the time of day can be several hours off. Repeat-By: There are several ways, the one below is how the problem was first spotted. Have a quiescent root filesystem (no files created or removed, etc) for several hours before a powerfail. After the autoreboot following restoration of power note that the system's time is very incorrect. Fix: Apply the small patch below to ufs_subr.c, remake and install the kernel. Superblocks are only updated to disc if something has changed. The problem is that on a system where /tmp is a separate partition of its own there is *very* little file creation/removal/etc taking place on the root filesystem. Thus the timestamp in the root superblock (where the time is picked up after a reboot) can fall seriously behind. The patch below forces the root fs superblock to be updated when a 'sync' call is done. The 'update' program does a 'sync' call once per minute - doing 1 additional disk i/o per minute is not likely to cause excessive overhead and it will keep the time current. ============================cut here=============================== *** /sys/sys/ufs_subr.c.old Thu Dec 24 09:49:00 1992 --- /sys/sys/ufs_subr.c Sat Mar 20 22:44:34 1993 *************** *** 3,9 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)ufs_subr.c 1.2 (2.11BSD GTE) 12/24/92 */ #include "param.h" --- 3,9 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)ufs_subr.c 1.3 (2.11BSD GTE) 3/18/93 */ #include "param.h" *************** *** 44,49 **** --- 44,51 ---- if (mp->m_inodp == NULL || mp->m_dev == NODEV) continue; fs = &mp->m_filsys; + if (mp->m_dev == rootdev) /* XXX */ + fs->fs_fmod = 1; /* XXX */ if (fs->fs_fmod == 0) continue; if (fs->fs_ronly != 0) { /* XXX */