From: Jeffrey Altman Date: Fri, 18 Oct 2013 23:26:56 +0000 (-0400) Subject: Windows: cm_NewSCache skip in hash recycled entries X-Git-Tag: openafs-stable-1_8_0pre1~954 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=6e26922f68d2b0f692212e6150d7955a0d393929 Windows: cm_NewSCache skip in hash recycled entries If cm_RecycleSCache returns an in-hash entry it means that either it wasn't recycled properly or somehow we raced this entry with another thread. Just skip it and keep searching. Change-Id: Ia443a04b063a019003662639d31f96db486d673c Reviewed-on: http://gerrit.openafs.org/10353 Tested-by: BuildBot Reviewed-by: Jeffrey Altman --- diff --git a/src/WINNT/afsd/cm_scache.c b/src/WINNT/afsd/cm_scache.c index a2432b5..1745e6d 100644 --- a/src/WINNT/afsd/cm_scache.c +++ b/src/WINNT/afsd/cm_scache.c @@ -373,15 +373,22 @@ cm_GetNewSCache(afs_uint32 locked) fileType = scp->fileType; if (!cm_RecycleSCache(scp, 0)) { - /* we found an entry, so return it. - * remove from the LRU queue and put it back at the - * head of the LRU queue. - */ - cm_AdjustScacheLRU(scp); - - /* and we're done - SUCCESS */ - osi_assertx(!(scp->flags & CM_SCACHEFLAG_INHASH), "CM_SCACHEFLAG_INHASH set"); - goto done; + if (!(scp->flags & CM_SCACHEFLAG_INHASH)) { + /* we found an entry, so return it. + * remove from the LRU queue and put it back at the + * head of the LRU queue. + */ + cm_AdjustScacheLRU(scp); + + /* and we're done - SUCCESS */ + goto done; + } + + /* + * Something went wrong. Could we have raced with another thread? + * Instead of panicking, just skip it. + */ + osi_Log1(afsd_logp, "GetNewSCache cm_RecycleSCache returned in hash scp 0x%p", scp); } lock_ReleaseWrite(&scp->rw); } else {