Windows: osisleep do not tamper with queues
authorJeffrey Altman <jaltman@your-file-system.com>
Tue, 27 Dec 2011 01:56:38 +0000 (20:56 -0500)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 31 Dec 2011 21:16:12 +0000 (13:16 -0800)
There is no need to manually remove an entry from a queue before
executing osi_QRemoveHT().  osi_QRemoveHT() removes the item
from the queue and fixes up the pointers correctly.  Manual
intervention is a waste of cpu and can be harmful.

Change-Id: Iaea4ceac2cb5f61e5bb73fd181bd934e06ddf0a6
Reviewed-on: http://gerrit.openafs.org/6437
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

src/WINNT/client_osi/osisleep.c

index 5b2e0d4..ddf4edf 100644 (file)
@@ -325,7 +325,6 @@ void osi_TSignal(osi_turnstile_t *turnp)
         return;
 
     sp = turnp->lastp;
-    turnp->lastp = (osi_sleepInfo_t *) osi_QPrev(&sp->q);
     osi_QRemoveHT((osi_queue_t **) &turnp->firstp, (osi_queue_t **) &turnp->lastp, &sp->q);
     sp->states |= OSI_SLEEPINFO_SIGNALLED;
     ReleaseSemaphore(sp->sema, 1, (long *) 0);
@@ -337,7 +336,6 @@ void osi_TBroadcast(osi_turnstile_t *turnp)
     osi_sleepInfo_t *sp;
 
     while(sp = turnp->lastp) {
-        turnp->lastp = (osi_sleepInfo_t *) osi_QPrev(&sp->q);
         osi_QRemoveHT((osi_queue_t **) &turnp->firstp, (osi_queue_t **) &turnp->lastp, &sp->q);
         sp->states |= OSI_SLEEPINFO_SIGNALLED;
         ReleaseSemaphore(sp->sema, 1, (long *) 0);
@@ -384,7 +382,6 @@ void osi_TSignalForMLs(osi_turnstile_t *turnp, int stillHaveReaders, CRITICAL_SE
          * and move to private one, so we can do the wakeup after releasing
          * the crit sec.
          */
-        turnp->lastp = (osi_sleepInfo_t *) osi_QPrev(&tsp->q);
         osi_QRemoveHT((osi_queue_t **) &turnp->firstp, (osi_queue_t **) &turnp->lastp, &tsp->q);
 
         /* do the patching required for lock obtaining */