Subject: Superblock timestamp change causes reboot loop (#177)
Index:	sys/ufs_subr.c 2.11BSD

Description:
	Changes fsck makes to the root filesystem's superblock are being
	ignored.

Repeat-By:
	Do a "reboot".  If fsck makes any changes to the root filesystem 
	notice that the fsck+reboot cycle will go on forever (missing
	blocks).

Fix:
	The problem is in the (small) change made almost a year ago
	to keep the timestamp in the superblock current.  The change
	was very successful at this but there was a side effect.  'fsck'
	does "sync" calls which cause the kernel to write its private
	copy of the superblock out, overwriting the changes fsck made.

	The fix is to remove the timestamp modification.  If it is
	desired to keep the superblock time current on an idle root fs
	it will be necessary to run a cron job (creating and removing a
	file in / would be sufficient).

------------------cut here
*** /sys/sys/ufs_subr.c.old	Thu Mar 18 20:40:51 1993
--- /sys/sys/ufs_subr.c	Tue Feb 15 15:13:59 1994
***************
*** 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"
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)ufs_subr.c	1.4 (2.11BSD GTE) 2/15/94
   */
  
  #include "param.h"
***************
*** 28,34 ****
  {
  	register struct mount *mp;
  	register struct buf *bp;
- 	struct fs *fsdst;
  
  	if (updlock)
  		return;
--- 28,33 ----
***************
*** 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 */
--- 43,48 ----
***************
*** 59,66 ****
  			continue;
  		fs->fs_fmod = 0;
  		fs->fs_time = time.tv_sec;
! 		fsdst = (struct fs *)mapin(bp);
! 		*fsdst = *fs;
  		mapout(bp);
  		bwrite(bp);
  	}
--- 56,62 ----
  			continue;
  		fs->fs_fmod = 0;
  		fs->fs_time = time.tv_sec;
! 		bcopy(fs, mapin(bp), sizeof (struct fs));
  		mapout(bp);
  		bwrite(bp);
  	}
