solaris10-nfs-really-20051013
authorLoïc Tortay <tortay@cc.in2p3.fr>
Thu, 13 Oct 2005 19:25:05 +0000 (19:25 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 13 Oct 2005 19:25:05 +0000 (19:25 +0000)
FIXES 22318

fix array size so this all works

src/afs/afs_nfsdisp.c
src/afs/afs_vcache.c

index d89ff02..41076ac 100644 (file)
@@ -63,8 +63,12 @@ struct afs_nfs2_resp {
 };
 
 #ifndef ACL2_NPROC
+#if defined(AFS_SUN510_ENV)
+#define ACL2_NPROC      6
+#else
 #define ACL2_NPROC      5
 #endif
+#endif
 struct afs_nfs_disp_tbl afs_rfs_disp_tbl[RFS_NPROC];
 struct afs_nfs_disp_tbl afs_acl_disp_tbl[ACL2_NPROC];
 
@@ -712,7 +716,7 @@ afs_acl2_getxattrdir(char *args, char *xp, char *exp, char *rp, char *crp)
 }
 #endif
 
-struct afs_nfs_disp_tbl afs_acl_disp_tbl[5] = {
+struct afs_nfs_disp_tbl afs_acl_disp_tbl[ACL2_NPROC] = {
     {afs_nfs2_null},
     {afs_acl2_getacl},
     {afs_acl2_setacl},
@@ -749,8 +753,12 @@ afs_xlatorinit_v2(struct rfs_disp_tbl *_rfs_tbl,
 #endif
 
 #ifndef ACL3_NPROC
+#if defined(AFS_SUN510_ENV)
+#define ACL3_NPROC      4
+#else
 #define ACL3_NPROC      3
 #endif
+#endif
 
 struct afs_nfs_disp_tbl afs_rfs3_disp_tbl[RFS3_NPROC];
 struct afs_nfs_disp_tbl afs_acl3_disp_tbl[ACL3_NPROC];
@@ -1611,7 +1619,7 @@ afs_acl3_getxattrdir(char *args, char *xp, char *exp, char *rp, char *crp)
 }
 #endif
 
-struct afs_nfs_disp_tbl afs_acl3_disp_tbl[3] = {
+struct afs_nfs_disp_tbl afs_acl3_disp_tbl[ACL3_NPROC] = {
     {afs_nfs2_null},
     {afs_acl3_getacl},
     {afs_acl3_setacl},
index a728ab4..ecc5f63 100644 (file)
@@ -71,7 +71,7 @@ struct afs_q VLRU;            /*vcache LRU */
 afs_int32 vcachegen = 0;
 unsigned int afs_paniconwarn = 0;
 struct vcache *afs_vhashT[VCSIZE];
-struct afs_q afs_vhashTV[VCSIZE];
+struct vcache *afs_vhashTV[VCSIZE];
 static struct afs_cbr *afs_cbrHashT[CBRSIZE];
 afs_int32 afs_bulkStatsLost;
 int afs_norefpanic = 0;
@@ -132,8 +132,8 @@ int
 afs_FlushVCache(struct vcache *avc, int *slept)
 {                              /*afs_FlushVCache */
 
-    afs_int32 i, code;
-    struct vcache **uvc, *wvc;
+    afs_int32 i, code, j;
+    struct vcache **uvc, *wvc, **uvc2, *wvc2;
 
     *slept = 0;
     AFS_STATCNT(afs_FlushVCache);
@@ -181,8 +181,17 @@ afs_FlushVCache(struct vcache *avc, int *slept)
     }
 
     /* remove entry from the volume hash table */
-    QRemove(&avc->vhashq);
-
+    j = VCHashV(&avc->fid);
+    uvc2 = &afs_vhashTV[j];
+    for (wvc2 = *uvc2; wvc2; uvc2 = &wvc2->vhnext, wvc2 = *uvc2) {
+        if (avc == wvc2) {
+            *uvc2 = avc->vhnext;
+            avc->vhnext = (struct vcache *)NULL;
+            break;
+        }
+    }
+    if (!wvc || !wvc2)
+       osi_Panic("flushvcache");       /* not in correct hash bucket */
     if (avc->mvid)
        osi_FreeSmallSpace(avc->mvid);
     avc->mvid = (struct VenusFid *)0;
@@ -617,6 +626,7 @@ afs_NewVCache(struct VenusFid *afid, struct server *serverp)
     if (((3 * afs_vcount) > nvnode) || (afs_vcount >= afs_maxvcount))
 #endif
     {
+       struct afs_q *tq, *uq;
        int i;
        char *panicstr;
 
@@ -1082,31 +1092,9 @@ restart:
     osi_dnlc_purgedp(tvc);     /* this may be overkill */
     memset((char *)&(tvc->callsort), 0, sizeof(struct afs_q));
     tvc->slocks = NULL;
-    i = VCHash(afid);
-    j = VCHashV(afid);
-
     tvc->states &=~ CVInit;
     afs_osi_Wakeup(&tvc->states);
 
-    tvc->hnext = afs_vhashT[i];
-    afs_vhashT[i] = tvc;
-    QAdd(&afs_vhashTV[i], &tvc->vhashq);
-
-    if ((VLRU.next->prev != &VLRU) || (VLRU.prev->next != &VLRU)) {
-       refpanic("NewVCache VLRU inconsistent");
-    }
-    QAdd(&VLRU, &tvc->vlruq);  /* put in lruq */
-    if ((VLRU.next->prev != &VLRU) || (VLRU.prev->next != &VLRU)) {
-       refpanic("NewVCache VLRU inconsistent2");
-    }
-    if (tvc->vlruq.next->prev != &(tvc->vlruq)) {
-       refpanic("NewVCache VLRU inconsistent3");
-    }
-    if (tvc->vlruq.prev->next != &(tvc->vlruq)) {
-       refpanic("NewVCache VLRU inconsistent4");
-    }
-    vcachegen++;
-
     return tvc;
 
 }                              /*afs_NewVCache */
@@ -2884,9 +2872,10 @@ afs_vcacheInit(int astatSize)
 #endif /* AFS_SGI62_ENV */
     }
 #endif
+
     QInit(&VLRU);
-    for(i = 0; i < VCSIZE; ++i)
-       QInit(&afs_vhashTV[i]);
+
+
 }
 
 /*
@@ -2962,7 +2951,7 @@ shutdown_vcache(void)
 
                afs_FreeAllAxs(&(tvc->Access));
            }
-           afs_vhashT[i] = 0;
+           afs_vhashT[i] = afs_vhashTV[i] = 0;
        }
     }
     /*
@@ -2987,6 +2976,5 @@ shutdown_vcache(void)
     RWLOCK_INIT(&afs_xvcache, "afs_xvcache");
     LOCK_INIT(&afs_xvcb, "afs_xvcb");
     QInit(&VLRU);
-    for(i = 0; i < VCSIZE; ++i)
-       QInit(&afs_vhashTV[i]);
+
 }