Windows: Set AFS_OBJECT_FLAGS_DIRECTORY_ENUMERATED
authorJeffrey Altman <jaltman@your-file-system.com>
Sat, 16 Feb 2013 22:51:12 +0000 (17:51 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Sat, 23 Feb 2013 08:21:18 +0000 (00:21 -0800)
Set the ObjectInformationCB AFS_OBJECT_FLAGS_DIRECTORY_ENUMERATED flag
from within the AFSEnumerateDirectory() function and not from its callers.

Change-Id: I2bddedba1165557679ddd9c637dbeb85cd74e1de
Reviewed-on: http://gerrit.openafs.org/9119
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsrdr/kernel/lib/AFSCommSupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSCreate.cpp
src/WINNT/afsrdr/kernel/lib/AFSDirControl.cpp
src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp
src/WINNT/afsrdr/kernel/lib/AFSNameSupport.cpp

index b005aa6..57186c7 100644 (file)
@@ -63,6 +63,12 @@ AFSEnumerateDirectory( IN GUID *AuthGroup,
 
         ASSERT( ExIsResourceAcquiredExclusiveLite( ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.TreeLock));
 
+        if( BooleanFlagOn( ObjectInfoCB->Flags, AFS_OBJECT_FLAGS_DIRECTORY_ENUMERATED))
+        {
+
+            try_return( ntStatus = STATUS_SUCCESS);
+        }
+
         uniGUID.Length = 0;
         uniGUID.MaximumLength = 0;
         uniGUID.Buffer = NULL;
@@ -683,14 +689,19 @@ try_exit:
             AFSExFreePoolWithTag( pBuffer, AFS_DIR_BUFFER_TAG);
         }
 
-        //
-        // If the processing failed then we should reset the directory content in the event
-        // it is re-enumerated
-        //
+        if ( NT_SUCCESS( ntStatus))
+        {
 
-        if( !NT_SUCCESS( ntStatus))
+            SetFlag( ObjectInfoCB->Flags, AFS_OBJECT_FLAGS_DIRECTORY_ENUMERATED);
+        }
+        else
         {
 
+            //
+            // If the processing failed then we should reset the directory
+            // content in the event it is re-enumerated
+            //
+
             AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
                           AFS_TRACE_LEVEL_ERROR,
                           "AFSEnumerateDirectory Resetting content for FID %08lX-%08lX-%08lX-%08lX Status %08lX\n",
index b93f554..23322bb 100644 (file)
@@ -1457,28 +1457,22 @@ AFSOpenRoot( IN PIRP Irp,
             AFSAcquireExcl( VolumeCB->ObjectInformation.Specific.Directory.DirectoryNodeHdr.TreeLock,
                             TRUE);
 
-            if( !BooleanFlagOn( VolumeCB->ObjectInformation.Flags, AFS_OBJECT_FLAGS_DIRECTORY_ENUMERATED))
-            {
-
-                ntStatus = AFSEnumerateDirectory( AuthGroup,
-                                                  &VolumeCB->ObjectInformation,
-                                                  TRUE);
-
-                if( !NT_SUCCESS( ntStatus))
-                {
+            ntStatus = AFSEnumerateDirectory( AuthGroup,
+                                              &VolumeCB->ObjectInformation,
+                                              TRUE);
 
-                    AFSReleaseResource( VolumeCB->ObjectInformation.Specific.Directory.DirectoryNodeHdr.TreeLock);
+            if( !NT_SUCCESS( ntStatus))
+            {
 
-                    AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
-                                  AFS_TRACE_LEVEL_ERROR,
-                                  "AFSOpenRoot (%p) Failed to enumerate directory Status %08lX\n",
-                                  Irp,
-                                  ntStatus);
+                AFSReleaseResource( VolumeCB->ObjectInformation.Specific.Directory.DirectoryNodeHdr.TreeLock);
 
-                    try_return( ntStatus);
-                }
+                AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                              AFS_TRACE_LEVEL_ERROR,
+                              "AFSOpenRoot (%p) Failed to enumerate directory Status %08lX\n",
+                              Irp,
+                              ntStatus);
 
-                SetFlag( VolumeCB->ObjectInformation.Flags, AFS_OBJECT_FLAGS_DIRECTORY_ENUMERATED);
+                try_return( ntStatus);
             }
 
             AFSReleaseResource( VolumeCB->ObjectInformation.Specific.Directory.DirectoryNodeHdr.TreeLock);
index 5fd860d..c2354d0 100644 (file)
@@ -459,8 +459,6 @@ AFSQueryDirectory( IN PIRP Irp)
 
                 try_return( ntStatus);
             }
-
-            SetFlag( pFcb->ObjectInformation->Flags, AFS_OBJECT_FLAGS_DIRECTORY_ENUMERATED);
         }
         else if( BooleanFlagOn( pFcb->ObjectInformation->Flags, AFS_OBJECT_FLAGS_VERIFY))
         {
index 5a1b9c3..2cf3644 100644 (file)
@@ -4819,12 +4819,6 @@ AFSEnumerateGlobalRoot( IN GUID *AuthGroup)
 
         pDirGlobalDirNode = AFSGlobalRoot->ObjectInformation.Specific.Directory.DirectoryNodeListHead;
 
-        //
-        // Indicate the node is initialized
-        //
-
-        SetFlag( AFSGlobalRoot->ObjectInformation.Flags, AFS_OBJECT_FLAGS_DIRECTORY_ENUMERATED);
-
         uniFullName.MaximumLength = PAGE_SIZE;
         uniFullName.Length = 0;
 
index cba608b..0e07722 100644 (file)
@@ -1215,8 +1215,6 @@ AFSLocateNameEntry( IN GUID *AuthGroup,
 
                         try_return( ntStatus);
                     }
-
-                    SetFlag( pDirEntry->ObjectInformation->Flags, AFS_OBJECT_FLAGS_DIRECTORY_ENUMERATED);
                 }
 
                 AFSReleaseResource( pCurrentObject->Specific.Directory.DirectoryNodeHdr.TreeLock);