Subject: kern/24813: Explicitly log dirty root file system
To: None <>
From: None <>
List: netbsd-bugs
Date: 03/17/2004 18:38:58
>Number:         24813
>Category:       kern
>Synopsis:       Explicitly log dirty root file system
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 17 09:40:00 UTC 2004
>Originator:     Taca Takahiro Kambe
>Release:        NetBSD 1.6.2
System: NetBSD 1.6.2 NetBSD 1.6.2 (CANCEL) #67: Sat Jan 31 08:37:30 JST 2004 i386
Architecture: i386
Machine: i386
	When the root file system wasn't unmounted cleanly,  fsck(8)
	normally would fix the file system.  But the root file system's
	dirty status isn't recorded, only it would be found no console.

	On old FreeBSD (I don't know recent release), it was logged as:

		WARNING: / was not properly dismounted.

	Power off the machine without normal shutdown and switch on.
	After system up again, you wouldn't found whether fsck(8) was
	performed or not.
	Adding simple log.

diff -u src/sys/ufs/ffs/ffs_vfsops.c.orig src/sys/ufs/ffs/ffs_vfsops.c
--- sys/ufs/ffs/ffs_vfsops.c	25 Sep 2003 10:03:49 -0000
+++ sys/ufs/ffs/ffs_vfsops.c	17 Mar 2004 09:33:49 -0000
@@ -165,6 +165,8 @@ ffs_mountroot()
 	(void)ffs_statfs(mp, &mp->mnt_stat, p);
+	if ((fs->fs_clean & FS_ISCLEAN) == 0)
+		printf("WARNING: root device was not properly unmounted.\n");
 	return (0);