windows-afscache-validate-20050806
authorJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 6 Aug 2005 01:34:50 +0000 (01:34 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 6 Aug 2005 01:34:50 +0000 (01:34 +0000)
Ensure that queues that have forward and reverse pointers are
consistent that either both are NULL or neither are.

src/WINNT/afsd/cm_aclent.c
src/WINNT/afsd/cm_buf.c
src/WINNT/afsd/cm_scache.c

index 42a0c0a..e34470a 100644 (file)
@@ -190,6 +190,13 @@ long cm_ValidateACLCache(void)
     long count;
     cm_aclent_t * aclp;
 
+    if ( cm_data.aclLRUp == NULL && cm_data.aclLRUEndp != NULL ||
+         cm_data.aclLRUp != NULL && cm_data.aclLRUEndp == NULL) {
+        afsi_log("cm_ValidateACLCache failure: inconsistent LRU pointers");
+        fprintf(stderr, "cm_ValidateACLCache failure: inconsistent LRU pointers\n");
+        return -9;
+    }
+
     for ( aclp = cm_data.aclLRUp, count = 0; aclp;
           aclp = (cm_aclent_t *) osi_QNext(&aclp->q), count++ ) {
         if (aclp->magic != CM_ACLENT_MAGIC) {
index b835f3b..cf0459e 100644 (file)
@@ -156,6 +156,13 @@ buf_ValidateBuffers(void)
     cm_buf_t * bp, *bpf, *bpa, *bpb;
     afs_uint32 countb = 0, countf = 0, counta = 0;
 
+    if (cm_data.buf_freeListp == NULL && cm_data.buf_freeListEndp != NULL ||
+         cm_data.buf_freeListp != NULL && cm_data.buf_freeListEndp == NULL) {
+        afsi_log("cm_ValidateBuffers failure: inconsistent free list pointers");
+        fprintf(stderr, "cm_ValidateBuffers failure: inconsistent free list pointers\n");
+        return -9;                  
+    }
+
     for (bp = cm_data.buf_freeListEndp; bp; bp=(cm_buf_t *) osi_QPrev(&bp->q)) { 
         if (bp->magic != CM_BUF_MAGIC) {
             afsi_log("cm_ValidateBuffers failure: bp->magic != CM_BUF_MAGIC");
@@ -470,7 +477,7 @@ void buf_WaitIO(cm_scache_t * scp, cm_buf_t *bp)
             lock_ObtainMutex(&scp->mx);
             if (scp->flags & CM_SCACHEFLAG_WAITING) {
                 osi_Log1(buf_logp, "buf_WaitIO waking scp 0x%x", scp);
-                osi_Wakeup(&scp->flags);
+                osi_Wakeup((long)&scp->flags);
                 lock_ReleaseMutex(&scp->mx);
             }
         }
index afe29e1..dc6387d 100644 (file)
@@ -203,6 +203,13 @@ cm_ValidateSCache(void)
     cm_scache_t * scp, *lscp;
     long i;
 
+    if ( cm_data.scacheLRUFirstp == NULL && cm_data.scacheLRULastp != NULL ||
+         cm_data.scacheLRUFirstp != NULL && cm_data.scacheLRULastp == NULL) {
+        afsi_log("cm_ValidateSCache failure: inconsistent LRU pointers");
+        fprintf(stderr, "cm_ValidateSCache failure: inconsistent LRU pointers\n");
+        return -17;
+    }
+
     for ( scp = cm_data.scacheLRUFirstp, lscp = NULL, i = 0; 
           scp;
           lscp = scp, scp = (cm_scache_t *) osi_QNext(&scp->q), i++ ) {