Windows: cm_NewSCache skip in hash recycled entries
authorJeffrey Altman <jaltman@your-file-system.com>
Fri, 18 Oct 2013 23:26:56 +0000 (19:26 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Sat, 26 Oct 2013 22:14:53 +0000 (15:14 -0700)
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 <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsd/cm_scache.c

index a2432b5..1745e6d 100644 (file)
@@ -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 {