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.
This commit is contained in:
parent
fe6301c61c
commit
74f3809a19
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=111510
@ -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.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user