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
This commit is contained in:
parent
72d28f97be
commit
c8f55fc4b4
@ -161,7 +161,7 @@ ffs_load_inode(struct buf *bp, struct inode *ip, struct fs *fs, ino_t ino)
|
|||||||
int
|
int
|
||||||
ffs_verify_dinode_ckhash(struct fs *fs, struct ufs2_dinode *dip)
|
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.
|
* 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_dinode *dip)
|
|||||||
*/
|
*/
|
||||||
save_ckhash = dip->di_ckhash;
|
save_ckhash = dip->di_ckhash;
|
||||||
dip->di_ckhash = 0;
|
dip->di_ckhash = 0;
|
||||||
if (save_ckhash != calculate_crc32c(~0L, (void *)dip, sizeof(*dip)))
|
ckhash = calculate_crc32c(~0L, (void *)dip, sizeof(*dip));
|
||||||
return (EINVAL);
|
|
||||||
dip->di_ckhash = save_ckhash;
|
dip->di_ckhash = save_ckhash;
|
||||||
return (0);
|
if (save_ckhash == ckhash)
|
||||||
|
return (0);
|
||||||
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user