windows-freelance-two-20080407
authorJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 7 Apr 2008 07:00:16 +0000 (07:00 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 7 Apr 2008 07:00:16 +0000 (07:00 +0000)
LICENSE MIT

do not add the scp into the hash table twice.

src/WINNT/afsd/cm_scache.c

index 70586b4..918b126 100644 (file)
@@ -724,9 +724,8 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp,
         }
         lock_ReleaseMutex(&cm_Freelance_Lock);
 
-        if (scp == NULL) 
+        if (scp == NULL)
             scp = cm_GetNewSCache();
-
        if (scp == NULL) {
            osi_Log0(afsd_logp,"cm_GetSCache unable to obtain *new* scache entry");
             lock_ReleaseWrite(&cm_scacheLock);
@@ -749,9 +748,11 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp,
         scp->dotdotFid.unique=1;
         scp->dotdotFid.vnode=1;
         scp->flags |= (CM_SCACHEFLAG_PURERO | CM_SCACHEFLAG_RO);
-        scp->nextp=cm_data.scacheHashTablep[hash];
-        cm_data.scacheHashTablep[hash]=scp;
-        scp->flags |= CM_SCACHEFLAG_INHASH;
+        if (!(scp->flags & CM_SCACHEFLAG_INHASH)) {
+            scp->nextp=cm_data.scacheHashTablep[hash];
+            cm_data.scacheHashTablep[hash]=scp;
+            scp->flags |= CM_SCACHEFLAG_INHASH;
+        }
         scp->refCount = 1;
        osi_Log1(afsd_logp,"cm_GetSCache (freelance) sets refCount to 1 scp 0x%x", scp);
         scp->fileType = fileType;