Windows: avoid race in cm_GetNewSCache
authorJeffrey Altman <jaltman@your-file-system.com>
Sat, 24 Dec 2011 08:15:53 +0000 (03:15 -0500)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 25 Dec 2011 05:46:40 +0000 (21:46 -0800)
commitff368a7ec70fca0673a21f6b283db13cabcc2286
treee740dc7857330598a22f587a559c039f0da927a4
parent17ce77f843e01ff96f66e05b4b932b0c6187493e
Windows: avoid race in cm_GetNewSCache

The cm_scacheLock is dropped while walking the scache LRU queue.
As a result it is possible for the cm_scache_t that is being
considered for recycling to be accessed and moved to the head
of the queue.

Track the prev and next pointers so it is possible to detect if
the cm_scache_t that is about to be recycled has been moved.  If
so, restart the search from the tail.

Change-Id: I6c3b645b85aa60197b9b6d60cffdcb818eb6f4b2
Reviewed-on: http://gerrit.openafs.org/6424
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
src/WINNT/afsd/cm_scache.c