Windows: AFSRequestExtentsAsync and AFSDoExtentsMapRegion
authorJeffrey Altman <jaltman@your-file-system.com>
Sat, 6 Oct 2012 21:36:25 +0000 (17:36 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Fri, 19 Oct 2012 12:41:34 +0000 (05:41 -0700)
When calling AFSDoExtentsMapRegion() the FCB ExtentsResource
must be held.   AFSRequestExtentsAsync() failed to hold the
ExtentsResource across the call.

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

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

index 2650de6..ccf13c0 100644 (file)
@@ -750,11 +750,33 @@ AFSRequestExtentsAsync( IN AFSFcb *Fcb,
         // Check if we are already mapped
         //
 
+        AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
+                      AFS_TRACE_LEVEL_VERBOSE,
+                      "AFSRequestExtentsAsync Acquiring Fcb extents lock %08lX SHARED %08lX\n",
+                      &pNPFcb->Specific.File.ExtentsResource,
+                      PsGetCurrentThread());
+
+        AFSAcquireShared( &pNPFcb->Specific.File.ExtentsResource, TRUE );
+
         bRegionMapped = AFSDoExtentsMapRegion( Fcb, Offset, Size, &pFirstExtent, &pExtent);
 
         if( bRegionMapped)
         {
 
+            KeClearEvent( &pNPFcb->Specific.File.ExtentsRequestComplete );
+        }
+
+        AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
+                      AFS_TRACE_LEVEL_VERBOSE,
+                      "AFSRequestExtentsAsync Releasing Fcb extents lock %08lX SHARED %08lX\n",
+                      &pNPFcb->Specific.File.ExtentsResource,
+                      PsGetCurrentThread());
+
+        AFSReleaseResource( &pNPFcb->Specific.File.ExtentsResource );
+
+        if ( bRegionMapped)
+        {
+
             try_return( ntStatus = STATUS_SUCCESS);
         }