diff options
author | iedowse <iedowse@FreeBSD.org> | 2001-04-24 00:37:16 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2001-04-24 00:37:16 +0000 |
commit | 383dd0a2656889604bb7eb71b993875024ddd832 (patch) | |
tree | 27c206456654624cddcce9e930e92a58e2438ebd /sys | |
parent | 21cf7b313e0bc24fdfba9db608502a795edc2f64 (diff) | |
download | FreeBSD-src-383dd0a2656889604bb7eb71b993875024ddd832.zip FreeBSD-src-383dd0a2656889604bb7eb71b993875024ddd832.tar.gz |
Pre-dirpref versions of fsck may zero out the new superblock fields
fs_contigdirs, fs_avgfilesize and fs_avgfpdir. This could cause
panics if these fields were zeroed while a filesystem was mounted
read-only, and then remounted read-write.
Add code to ffs_reload() which copies the fs_contigdirs pointer
from the previous superblock, and reinitialises fs_avgf* if necessary.
Reviewed by: mckusick
Diffstat (limited to 'sys')
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 2f23717..58a2dfc 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -423,12 +423,18 @@ ffs_reload(mp, cred, p) */ newfs->fs_csp = fs->fs_csp; newfs->fs_maxcluster = fs->fs_maxcluster; + newfs->fs_contigdirs = fs->fs_contigdirs; bcopy(newfs, fs, (u_int)fs->fs_sbsize); if (fs->fs_sbsize < SBSIZE) bp->b_flags |= B_INVAL | B_NOCACHE; brelse(bp); mp->mnt_maxsymlinklen = fs->fs_maxsymlinklen; ffs_oldfscompat(fs); + /* An old fsck may have zeroed these fields, so recheck them. */ + if (fs->fs_avgfilesize <= 0) /* XXX */ + fs->fs_avgfilesize = AVFILESIZ; /* XXX */ + if (fs->fs_avgfpdir <= 0) /* XXX */ + fs->fs_avgfpdir = AFPDIR; /* XXX */ /* * Step 3: re-read summary information from disk. |