summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2003-02-25 23:21:08 +0000
committermckusick <mckusick@FreeBSD.org>2003-02-25 23:21:08 +0000
commit259fedfc3c31b8d9e7baaea3ffe4112cea37511a (patch)
treed5f219b74d598030bc288d170776c12d5a1cc4f7 /sys/ufs
parent8c4aaea3e2b50ba0f23f0712fb2a02c3667c7fdd (diff)
downloadFreeBSD-src-259fedfc3c31b8d9e7baaea3ffe4112cea37511a.zip
FreeBSD-src-259fedfc3c31b8d9e7baaea3ffe4112cea37511a.tar.gz
Change the field used to test whether the superblock has been updated
from the filesystem size field to the filesystem maximum blocksize field. The problem is that older versions of growfs updated only the new size field and not the old size field. This resulted in the old (smaller) size field being copied up to the new size field which caused the filesystem to appear to fsck to be badly trashed. This also adds a sanity check to ensure that the superblock is not being updated when the filesystem is mounted read-only. Obviously such an update should never happen. Reported by: Nate Lawson <nate@root.org> Sponsored by: DARPA & NAI Labs.
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 17e9a40..1d9cd21 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -872,7 +872,7 @@ ffs_oldfscompat_read(fs, ump, sblockloc)
/*
* If not yet done, update UFS1 superblock with new wider fields.
*/
- if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_size != fs->fs_old_size) {
+ if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_maxbsize != fs->fs_bsize) {
fs->fs_maxbsize = fs->fs_bsize;
fs->fs_time = fs->fs_old_time;
fs->fs_size = fs->fs_old_size;
@@ -1469,6 +1469,10 @@ ffs_sbupdate(mp, waitfor)
void *space;
int i, size, error, allerror = 0;
+ if (fs->fs_ronly == 1 &&
+ (mp->um_mountp->mnt_flag & (MNT_RDONLY | MNT_UPDATE)) !=
+ (MNT_RDONLY | MNT_UPDATE))
+ panic("ffs_sbupdate: write read-only filesystem");
/*
* First write back the summary information.
*/
OpenPOWER on IntegriCloud