Move the check for the filesystem having been run on a kernel that
predates metadata check hashes so that it is done before deciding whether to compute a check-hash of the superblock. Reported by: Rick Macklem <rmacklem@uoguelph.ca> Sponsored by: Netflix
This commit is contained in:
parent
a0e9218c01
commit
a02bd3e38c
sys/ufs/ffs
@ -276,6 +276,12 @@ readsuper(void *devfd, struct fs **fsp, off_t sblockloc, int isaltsblk,
|
|||||||
fs->fs_bsize <= MAXBSIZE &&
|
fs->fs_bsize <= MAXBSIZE &&
|
||||||
fs->fs_bsize >= roundup(sizeof(struct fs), DEV_BSIZE) &&
|
fs->fs_bsize >= roundup(sizeof(struct fs), DEV_BSIZE) &&
|
||||||
fs->fs_sbsize <= SBLOCKSIZE) {
|
fs->fs_sbsize <= SBLOCKSIZE) {
|
||||||
|
/*
|
||||||
|
* If the filesystem has been run on a kernel without
|
||||||
|
* metadata check hashes, disable them.
|
||||||
|
*/
|
||||||
|
if ((fs->fs_flags & FS_METACKHASH) == 0)
|
||||||
|
fs->fs_metackhash = 0;
|
||||||
if (fs->fs_ckhash != (ckhash = ffs_calc_sbhash(fs))) {
|
if (fs->fs_ckhash != (ckhash = ffs_calc_sbhash(fs))) {
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
res = uprintf("Superblock check-hash failed: recorded "
|
res = uprintf("Superblock check-hash failed: recorded "
|
||||||
|
@ -813,9 +813,6 @@ ffs_mountfs(devvp, mp, td)
|
|||||||
if ((error = ffs_sbget(devvp, &fs, -1, M_UFSMNT, ffs_use_bread)) != 0)
|
if ((error = ffs_sbget(devvp, &fs, -1, M_UFSMNT, ffs_use_bread)) != 0)
|
||||||
goto out;
|
goto out;
|
||||||
fs->fs_fmod = 0;
|
fs->fs_fmod = 0;
|
||||||
/* if we ran on a kernel without metadata check hashes, disable them */
|
|
||||||
if ((fs->fs_flags & FS_METACKHASH) == 0)
|
|
||||||
fs->fs_metackhash = 0;
|
|
||||||
/* none of these types of check-hashes are maintained by this kernel */
|
/* none of these types of check-hashes are maintained by this kernel */
|
||||||
fs->fs_metackhash &= ~(CK_INODE | CK_INDIR | CK_DIR);
|
fs->fs_metackhash &= ~(CK_INODE | CK_INDIR | CK_DIR);
|
||||||
/* no support for any undefined flags */
|
/* no support for any undefined flags */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user