DEVEL15-windows-scache-verification-20080307

LICENSE MIT

Add a hash value verification check for stat cache entries


(cherry picked from commit 45200a26985678ccad051385f50f94321eb98256)
This commit is contained in:
Jeffrey Altman 2008-03-07 17:46:00 +00:00
parent 8d4347a687
commit 217e7d6889

View File

@ -463,6 +463,8 @@ cm_ValidateSCache(void)
for ( i=0; i < cm_data.scacheHashTableSize; i++ ) {
for ( scp = cm_data.scacheHashTablep[i]; scp; scp = scp->nextp ) {
afs_uint32 hash;
hash = CM_SCACHE_HASH(&scp->fid);
if (scp->magic != CM_SCACHE_MAGIC) {
afsi_log("cm_ValidateSCache failure: scp->magic != CM_SCACHE_MAGIC");
fprintf(stderr, "cm_ValidateSCache failure: scp->magic != CM_SCACHE_MAGIC\n");
@ -483,6 +485,11 @@ cm_ValidateSCache(void)
fprintf(stderr, "cm_ValidateSCache failure: scp->volp->magic != CM_VOLUME_MAGIC\n");
return -12;
}
if (hash != i) {
afsi_log("cm_ValidateSCache failure: scp hash != hash index");
fprintf(stderr, "cm_ValidateSCache failure: scp hash != hash index\n");
return -13;
}
}
}