]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Windows: do not flush dirty extents without permission
authorJeffrey Altman <jaltman@your-file-system.com>
Wed, 4 Jan 2012 04:12:34 +0000 (23:12 -0500)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 11 Jan 2012 03:49:54 +0000 (19:49 -0800)
When closing file handles, do not permit dirty extents to be
released back to the service if the current handle (Ccb) does
not have write permission.  The cleanup operation will fail with
STATUS_ACCESS_DENIED, the extents will be released and all of the
dirty data will be discarded.

Change-Id: Iceacf5319147d1bd6277ea160bc67d91f1a49d5b
Reviewed-on: http://gerrit.openafs.org/6500
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
src/WINNT/afsrdr/kernel/lib/AFSClose.cpp

index 938288f60a1384921b10f30ad1a0712911236b7f..e1a37bf76cabde8f3dd7de9944c2502fb8e4c2d0 100644 (file)
@@ -510,15 +510,13 @@ AFSClose( IN PDEVICE_OBJECT LibDeviceObject,
                 else
                 {
 
-                    if( pFcb->Header.NodeTypeCode == AFS_FILE_FCB)
+                    if( pFcb->Header.NodeTypeCode == AFS_FILE_FCB &&
+                        pFcb->Specific.File.ExtentsDirtyCount &&
+                        (pCcb->GrantedAccess & FILE_WRITE_DATA))
                     {
 
-                        if( pFcb->Specific.File.ExtentsDirtyCount)
-                        {
-
-                            AFSFlushExtents( pFcb,
-                                             &pCcb->AuthGroup);
-                        }
+                        AFSFlushExtents( pFcb,
+                                         &pCcb->AuthGroup);
                     }
 
                     AFSReleaseResource( &pFcb->NPFcb->Resource);