svn commit: r342134 - head/sys/ufs/ffs
Kirk McKusick
mckusick at FreeBSD.org
Sat Dec 15 18:49:31 UTC 2018
Author: mckusick
Date: Sat Dec 15 18:49:30 2018
New Revision: 342134
URL: https://svnweb.freebsd.org/changeset/base/342134
Log:
Ensure that the inode check-hash is not left zeroed out in the case where
the check-hash fails. Prior to the fix in -r342133 the inode with the
zeroed out check-hash was written back to disk causing further confusion.
Reported by: Gary Jennejohn (gj)
Sponsored by: Netflix
Modified:
head/sys/ufs/ffs/ffs_subr.c
Modified: head/sys/ufs/ffs/ffs_subr.c
==============================================================================
--- head/sys/ufs/ffs/ffs_subr.c Sat Dec 15 18:35:46 2018 (r342133)
+++ head/sys/ufs/ffs/ffs_subr.c Sat Dec 15 18:49:30 2018 (r342134)
@@ -161,7 +161,7 @@ ffs_load_inode(struct buf *bp, struct inode *ip, struc
int
ffs_verify_dinode_ckhash(struct fs *fs, struct ufs2_dinode *dip)
{
- uint32_t save_ckhash;
+ uint32_t ckhash, save_ckhash;
/*
* Return success if unallocated or we are not doing inode check-hash.
@@ -174,10 +174,11 @@ ffs_verify_dinode_ckhash(struct fs *fs, struct ufs2_di
*/
save_ckhash = dip->di_ckhash;
dip->di_ckhash = 0;
- if (save_ckhash != calculate_crc32c(~0L, (void *)dip, sizeof(*dip)))
- return (EINVAL);
+ ckhash = calculate_crc32c(~0L, (void *)dip, sizeof(*dip));
dip->di_ckhash = save_ckhash;
- return (0);
+ if (save_ckhash == ckhash)
+ return (0);
+ return (EINVAL);
}
/*
More information about the svn-src-head
mailing list