Windows: AFSFlushExtents QueuedFlushCount leak
authorJeffrey Altman <jaltman@your-file-system.com>
Tue, 23 Oct 2012 00:34:59 +0000 (20:34 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Sun, 28 Oct 2012 01:49:57 +0000 (18:49 -0700)
The FCB QueuedFlushCount was decremented in all code paths
but only incremented if the AuthGroup acquisition succeeded.
Increment the counter before the AuthGroup checks.

Change-Id: I3f58075124412cc4a7ac63dc6a7f90a91af369cf
Reviewed-on: http://gerrit.openafs.org/8303
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsrdr/kernel/lib/AFSExtentsSupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSWorker.cpp

index c8c207b..a5c2984 100644 (file)
@@ -2585,6 +2585,8 @@ AFSFlushExtents( IN AFSFcb *Fcb,
     __Enter
     {
 
+        lCount = InterlockedIncrement( &Fcb->Specific.File.QueuedFlushCount);
+
         if( pAuthGroup == NULL ||
             RtlCompareMemory( pAuthGroup,
                               &Fcb->NPFcb->Specific.File.ExtentsRequestAuthGroup,
@@ -2616,8 +2618,6 @@ AFSFlushExtents( IN AFSFcb *Fcb,
 
         bExtentsLocked = TRUE;
 
-        lCount = InterlockedIncrement( &Fcb->Specific.File.QueuedFlushCount);
-
         //
         // Clear our queued flush event
         //
@@ -2815,6 +2815,8 @@ try_exit:
 
         lCount = InterlockedDecrement( &Fcb->Specific.File.QueuedFlushCount);
 
+       ASSERT( lCount >= 0);
+
         if( lCount == 0)
         {
 
index 6d649bf..cf28e9f 100644 (file)
@@ -2258,6 +2258,8 @@ try_exit:
 
         lCount = InterlockedDecrement( &Fcb->Specific.File.QueuedFlushCount);
 
+       ASSERT( lCount >= 0);
+
         if( lCount == 0)
         {