From 3f6f17ee1e1ea826cd2be78508759063dcb0b9f0 Mon Sep 17 00:00:00 2001 From: Julian Elischer Date: Wed, 13 Nov 1996 01:45:56 +0000 Subject: [PATCH] Submitted by: Archie and me. We encountered an interesting situation where the superblock for a file system got written to disk with the "fs_fmod" flag set to one. It appears that this flag is normally supposed to be cleared during ffs_sync(), but we experienced a crash, or some other weird occurrence that left it on the disk set to 1. Later this partition was mounted read-only... and the fs_fmod field was never cleared, causing ffs_sync() to panic "rofs mod" when trying to unmount that filesystem (ffs_vfsops.c: line 790). fix: set this bit to 0 when you load the superblock from disk. (see more complete mail on this to hackers) --- sys/ufs/ffs/ffs_vfsops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index a35502a8e0a0..e7850860f9e5 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94 - * $Id: ffs_vfsops.c,v 1.40 1996/08/21 21:56:09 dyson Exp $ + * $Id: ffs_vfsops.c,v 1.41 1996/09/07 17:34:57 dyson Exp $ */ #include "opt_quota.h" @@ -383,6 +383,7 @@ ffs_reload(mp, cred, p) if (error) return (error); fs = (struct fs *)bp->b_data; + fs->fs_fmod = 0; if (fs->fs_magic != FS_MAGIC || fs->fs_bsize > MAXBSIZE || fs->fs_bsize < sizeof(struct fs)) { brelse(bp); @@ -511,6 +512,7 @@ ffs_mountfs(devvp, mp, p) error = EINVAL; /* XXX needs translation */ goto out; } + fs->fs_fmod = 0; if (!fs->fs_clean) { if (ronly || (mp->mnt_flag & MNT_FORCE)) { printf("WARNING: %s was not properly dismounted.\n",fs->fs_fsmnt);