Subject: kern/24813: Explicitly log dirty root file system
To: None <gnats-bugs@gnats.netbsd.org>
From: None <taca@kyoto.jone-system.com>
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
>Closed-Date:
>Last-Modified:
>Originator:     Taca Takahiro Kambe
>Release:        NetBSD 1.6.2
>Organization:
	
>Environment:
	
	
System: NetBSD cancel.kyoto.jone-system.com 1.6.2 NetBSD 1.6.2 (CANCEL) #67: Sat Jan 31 08:37:30 JST 2004 support@kyoto.jone-system.com:/usr/src/sys/arch/i386/compile/CANCEL i386
Architecture: i386
Machine: i386
>Description:
	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.

>How-To-Repeat:
	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.
>Fix:
	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	1.1.1.1.2.1
+++ 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);
 	vfs_unbusy(mp);
 	inittodr(fs->fs_time);
+	if ((fs->fs_clean & FS_ISCLEAN) == 0)
+		printf("WARNING: root device was not properly unmounted.\n");
 	return (0);
 }
 
>Release-Note:
>Audit-Trail:
>Unformatted: