diff options
author | marcel <marcel@FreeBSD.org> | 2005-11-19 21:51:45 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2005-11-19 21:51:45 +0000 |
commit | 7fe698f6976536c85680aceafd4dbb94664ec9c9 (patch) | |
tree | c9ef79b275decabe8826aa341cca7410792a4719 /sys/kern | |
parent | 9cf0eb5132a55c7f6138e8e1b352d7ba3d3732b9 (diff) | |
download | FreeBSD-src-7fe698f6976536c85680aceafd4dbb94664ec9c9.zip FreeBSD-src-7fe698f6976536c85680aceafd4dbb94664ec9c9.tar.gz |
Fix bug introduced in revision 1.186:
When all file systems have a time stamp of zero, which is the case
for example when the root file system is on a read-only medium, we
ended up not calling inittodr() at all. A potential uncleanliness
existed as well. If multiple file systems had a non-zero time stamp,
we would call inittodr() multiple times. While this should not be
harmful, it's definitely not ideal.
Fix both issues by iterating over the mounted file systems to find
the largest time stamp and call inittodr() exactly once with that
time stamp. This could of course be a zero time stamp if none of the
mounted file systems have a non-zero time stamp. In that case the
annoying errors mentioned in the commit log for revision 1.186 still
haven't been avoided. The bottom line is that inittodr() should not
complain when it gets a time base of zero. At the time of this
commit only alpha seems to have that problem.
Reported by: Dario Freni (saturnero at freesbie dot org)
MFC after: 1 week
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_mount.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index e756fcd..f3214dd 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -1379,8 +1379,9 @@ vfs_mountroot(void) static int vfs_mountroot_try(const char *mountfrom) { - struct mount *mp; + struct mount *mp; char *vfsname, *path; + time_t timebase; int error; char patt[32]; @@ -1423,12 +1424,16 @@ vfs_mountroot_try(const char *mountfrom) * the time stamp found to check and/or initialize the RTC. * Typically devfs has no time stamp and the only other FS * is the actual / FS. + * Call inittodr() only once and pass it the largest of the + * timestamps we encounter. */ + timebase = 0; do { - if (mp->mnt_time != 0) - inittodr(mp->mnt_time); + if (mp->mnt_time > timebase) + timebase = mp->mnt_time; mp = TAILQ_NEXT(mp, mnt_list); } while (mp != NULL); + inittodr(timebase); devfs_fixup(curthread); } |