freebsd-skq/sys/ufs/ffs
Kirk McKusick 996d40f91d Various new check-hash checks have been added to the UFS filesystem
over various major releases. Superblock check hashes were added for
the 12 release and cylinder-group and inode check hashes will appear
in the 13 release.

When a disk with a UFS filesystem is writably mounted, the kernel
clears the feature flags for anything that it does not support. For
example, if a UFS disk from a 12-stable kernel is mounted on an
11-stable system, the 11-stable kernel will clear the flag in the
filesystem superblock that indicates that superblock check-hashs
are being maintained. Thus if the disk is later moved back to a
12-stable system, the 12-stable system will know to ignore its
incorrect check-hash.

If the only filesystem modification done on the earlier kernel is
to run a utility such as growfs(8) that modifies the superblock but
neither updates the check-hash nor clears the feature flag indicating
that it does not support the check-hash, the disk will fail to mount
if it is moved back to its original newer kernel.

This patch moves the code that clears the filesystem feature flags
from the mount code (ffs_mountfs()) to the code that reads the
superblock (ffs_sbget()). As ffs_sbget() is used by the kernel mount
code and is imported into libufs(3), all the filesystem utilities
will now also clear these flags when they make modifications to the
filesystem.

As suggested by John Baldwin, fsck_ffs(8) has been changed to accept
and repair bad superblock check-hashes rather than refusing to run.
This change allows fsck to recover filesystems that have been impacted
by utilities older than those created after this change and is a
sensible thing to do in any event.

Reported by:  John Baldwin (jhb@)
MFC after:    2 weeks
Sponsored by: Netflix
2020-10-25 00:43:48 +00:00
..
ffs_alloc.c Do not copy vp into f_data for DTYPE_VNODE files. 2020-09-15 21:55:21 +00:00
ffs_balloc.c ufs: clean up empty lines in .c and .h files 2020-09-01 21:23:00 +00:00
ffs_extern.h ufs: clean up empty lines in .c and .h files 2020-09-01 21:23:00 +00:00
ffs_inode.c ufs: clean up empty lines in .c and .h files 2020-09-01 21:23:00 +00:00
ffs_rawread.c vmapbuf: don't smuggle address or length in buf 2020-10-21 16:00:15 +00:00
ffs_snapshot.c Move the pointers stored in the superblock into a separate 2020-06-19 01:02:53 +00:00
ffs_softdep.c ufs: clean up empty lines in .c and .h files 2020-09-01 21:23:00 +00:00
ffs_subr.c Various new check-hash checks have been added to the UFS filesystem 2020-10-25 00:43:48 +00:00
ffs_suspend.c Use the devfs vnode rather than the mntfs vnode for permissions checks. 2020-03-09 15:55:13 +00:00
ffs_tables.c
ffs_vfsops.c Various new check-hash checks have been added to the UFS filesystem 2020-10-25 00:43:48 +00:00
ffs_vnops.c ufs: clean up empty lines in .c and .h files 2020-09-01 21:23:00 +00:00
fs.h Various new check-hash checks have been added to the UFS filesystem 2020-10-25 00:43:48 +00:00
softdep.h This commit enables a UFS filesystem to do a forcible unmount when 2020-05-25 23:47:31 +00:00