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)
This commit is contained in:
Julian Elischer 1996-11-13 01:45:56 +00:00
parent 4c640c1689
commit 3f6f17ee1e

View File

@ -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);