Windows: forget data version only for flushing
authorJeffrey Altman <jaltman@your-file-system.com>
Sat, 17 Dec 2011 17:08:49 +0000 (12:08 -0500)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 18 Dec 2011 13:47:44 +0000 (05:47 -0800)
The AFS redirector was intentionally forgetting the data version
number for AFS_INVALIDATE_DATA_VERSION events.  The point of that
event is to ensure that clean data be purged if the data version
in fact changed.  Checking the data version for change cannot be
performed if the data version is reset to -1.

Only when AFS_INVALIDATE_FLUSHED is processed should the data
version be reset to ensure that all of the data is purged.

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

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

index cdbeee3..84cca30 100644 (file)
@@ -1709,10 +1709,12 @@ AFSInvalidateCache( IN AFSInvalidateCacheCB *InvalidateCB)
             else
             {
 
-                if( InvalidateCB->Reason == AFS_INVALIDATE_FLUSHED ||
-                    InvalidateCB->Reason == AFS_INVALIDATE_DATA_VERSION)
+                if( InvalidateCB->Reason == AFS_INVALIDATE_FLUSHED)
                 {
+
                     pObjectInfo->DataVersion.QuadPart = (ULONGLONG)-1;
+
+                    SetFlag( pObjectInfo->Flags, AFS_OBJECT_FLAGS_VERIFY_DATA);
                 }
 
                 pObjectInfo->Expiration.QuadPart = 0;
@@ -1878,6 +1880,23 @@ AFSInvalidateCache( IN AFSInvalidateCacheCB *InvalidateCB)
                     (VOID) AFSTearDownFcbExtents( pObjectInfo->Fcb);
                 }
 
+                pObjectInfo->DataVersion.QuadPart = (ULONGLONG)-1;
+
+
+                if( pObjectInfo->FileType == AFS_FILE_TYPE_FILE)
+                {
+
+                    AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                  AFS_TRACE_LEVEL_VERBOSE,
+                                  "AFSInvalidateCache Setting VERIFY_DATA flag on fid %08lX-%08lX-%08lX-%08lX\n",
+                                  pObjectInfo->FileId.Cell,
+                                  pObjectInfo->FileId.Volume,
+                                  pObjectInfo->FileId.Vnode,
+                                  pObjectInfo->FileId.Unique);
+
+                    SetFlag( pObjectInfo->Flags, AFS_OBJECT_FLAGS_VERIFY_DATA);
+                }
+
                 // Fall through to the default processing
             }
 
@@ -1928,26 +1947,6 @@ AFSInvalidateCache( IN AFSInvalidateCacheCB *InvalidateCB)
 
                 SetFlag( pObjectInfo->Flags, AFS_OBJECT_FLAGS_VERIFY);
 
-                if( InvalidateCB->Reason == AFS_INVALIDATE_FLUSHED ||
-                    InvalidateCB->Reason == AFS_INVALIDATE_DATA_VERSION)
-                {
-                    pObjectInfo->DataVersion.QuadPart = (ULONGLONG)-1;
-
-                    if( pObjectInfo->FileType == AFS_FILE_TYPE_FILE)
-                    {
-
-                        AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
-                                      AFS_TRACE_LEVEL_VERBOSE,
-                                      "AFSInvalidateCache Setting VERIFY_DATA flag on fid %08lX-%08lX-%08lX-%08lX\n",
-                                      pObjectInfo->FileId.Cell,
-                                      pObjectInfo->FileId.Volume,
-                                      pObjectInfo->FileId.Vnode,
-                                      pObjectInfo->FileId.Unique);
-
-                        SetFlag( pObjectInfo->Flags, AFS_OBJECT_FLAGS_VERIFY_DATA);
-                    }
-                }
-
                 break;
             }
         }
@@ -2460,8 +2459,7 @@ AFSInvalidateVolume( IN AFSVolumeCB *VolumeCB,
 
                 SetFlag( VolumeCB->ObjectInformation.Flags, AFS_OBJECT_FLAGS_VERIFY);
 
-                if( Reason == AFS_INVALIDATE_FLUSHED ||
-                    Reason == AFS_INVALIDATE_DATA_VERSION)
+                if( Reason == AFS_INVALIDATE_FLUSHED)
                 {
 
                     VolumeCB->ObjectInformation.DataVersion.QuadPart = (ULONGLONG)-1;
@@ -2520,25 +2518,25 @@ AFSInvalidateVolume( IN AFSVolumeCB *VolumeCB,
 
                     SetFlag( pCurrentObject->Flags, AFS_OBJECT_FLAGS_VERIFY);
 
-                    if( Reason == AFS_INVALIDATE_FLUSHED ||
-                        Reason == AFS_INVALIDATE_DATA_VERSION)
+                    if( Reason == AFS_INVALIDATE_FLUSHED)
                     {
 
                         pCurrentObject->DataVersion.QuadPart = (ULONGLONG)-1;
+                    }
 
-                        if( pCurrentObject->FileType == AFS_FILE_TYPE_FILE)
-                        {
+                    if( Reason == AFS_INVALIDATE_FLUSHED &&
+                        pCurrentObject->FileType == AFS_FILE_TYPE_FILE)
+                    {
 
-                            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
-                                          AFS_TRACE_LEVEL_VERBOSE,
-                                          "AFSInvalidateVolume Setting VERIFY_DATA flag on fid %08lX-%08lX-%08lX-%08lX\n",
-                                          pCurrentObject->FileId.Cell,
-                                          pCurrentObject->FileId.Volume,
-                                          pCurrentObject->FileId.Vnode,
-                                          pCurrentObject->FileId.Unique);
+                        AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                      AFS_TRACE_LEVEL_VERBOSE,
+                                      "AFSInvalidateVolume Setting VERIFY_DATA flag on fid %08lX-%08lX-%08lX-%08lX\n",
+                                      pCurrentObject->FileId.Cell,
+                                      pCurrentObject->FileId.Volume,
+                                      pCurrentObject->FileId.Vnode,
+                                      pCurrentObject->FileId.Unique);
 
-                            SetFlag( pCurrentObject->Flags, AFS_OBJECT_FLAGS_VERIFY_DATA);
-                        }
+                        SetFlag( pCurrentObject->Flags, AFS_OBJECT_FLAGS_VERIFY_DATA);
                     }
 
                     if( pCurrentObject->FileType == AFS_FILE_TYPE_DIRECTORY)