Windows: AFSCachedWrite reset LastServerFlush when Forced
authorJeffrey Altman <jaltman@your-file-system.com>
Fri, 7 Dec 2012 04:24:44 +0000 (23:24 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Fri, 7 Dec 2012 14:49:38 +0000 (06:49 -0800)
If the ForceFlush parameter to AFSCachedWrite is set to TRUE,
the Fcb->Specific.File.LastServerFlush value must be reset to
ensure that the AFSPrimaryVolumeWorkerThread will trigger an
extent flush on its next pass.  The LastServerFlush value will
not be reset by AFSNonCachedWrite() when called as a result of
a CcFlushCache() call as it appears to be PagingIo.

Change-Id: I72c368e05f30f04b13b2c6d098bdb1da578ac82c
Reviewed-on: http://gerrit.openafs.org/8717
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/AFSWrite.cpp

index f0d3f37..31dd55a 100644 (file)
@@ -1614,7 +1614,8 @@ AFSCachedWrite( IN PDEVICE_OBJECT DeviceObject,
                 try_return( ntStatus);
             }
 
-            if( ForceFlush)
+            if( ForceFlush ||
+                BooleanFlagOn(pFileObject->Flags, (FO_NO_INTERMEDIATE_BUFFERING + FO_WRITE_THROUGH)))
             {
 
                 //
@@ -1680,7 +1681,8 @@ try_exit:
                 pFcb->Header.ValidDataLength.QuadPart = StartingByte.QuadPart + ByteCount;
             }
 
-            if (BooleanFlagOn(pFileObject->Flags, (FO_NO_INTERMEDIATE_BUFFERING + FO_WRITE_THROUGH)))
+            if ( ForceFlush ||
+                 BooleanFlagOn(pFileObject->Flags, (FO_NO_INTERMEDIATE_BUFFERING + FO_WRITE_THROUGH)))
             {
                 //
                 // Write through asked for... Set things so that we get