Windows: New Trace for DirEntry tracking problem
authorPeter Scott <pscott@kerneldrivers.com>
Thu, 20 Oct 2011 18:39:31 +0000 (14:39 -0400)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 25 Oct 2011 17:49:57 +0000 (10:49 -0700)
Incuded in this patch is additional trace for logging how
directory entries are added, modified and deleted throughout
the redirector

Change-Id: I7ea80331ca24d543579603986f4eb6bcdd0bf072
Reviewed-on: http://gerrit.openafs.org/5640
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

src/WINNT/afsrdr/kernel/lib/AFSCleanup.cpp
src/WINNT/afsrdr/kernel/lib/AFSCommSupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp
src/WINNT/afsrdr/kernel/lib/AFSNameSupport.cpp

index be8fedd..554b1aa 100644 (file)
@@ -422,6 +422,15 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject,
 
                             AFSReleaseResource( pObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock);
                         }
+                        else
+                        {
+
+                            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                          AFS_TRACE_LEVEL_VERBOSE,
+                                          "AFSCleanup DE %p for %wZ NOT removing entry due to flag set\n",
+                                          pCcb->DirectoryCB,
+                                          &pCcb->DirectoryCB->NameInformation.FileName);
+                        }
                     }
                 }
                 else
@@ -731,6 +740,15 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject,
 
                             AFSReleaseResource( pObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock);
                         }
+                        else
+                        {
+
+                            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                          AFS_TRACE_LEVEL_VERBOSE,
+                                          "AFSCleanup DE %p for %wZ NOT removing entry due to flag set\n",
+                                          pCcb->DirectoryCB,
+                                          &pCcb->DirectoryCB->NameInformation.FileName);
+                        }
                     }
                 }
 
@@ -975,6 +993,15 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject,
 
                             AFSReleaseResource( pObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock);
                         }
+                        else
+                        {
+
+                            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                          AFS_TRACE_LEVEL_VERBOSE,
+                                          "AFSCleanup DE %p for %wZ NOT removing entry due to flag set\n",
+                                          pCcb->DirectoryCB,
+                                          &pCcb->DirectoryCB->NameInformation.FileName);
+                        }
                     }
                 }
 
index 74acdaa..98049c5 100644 (file)
@@ -267,6 +267,13 @@ AFSEnumerateDirectory( IN GUID *AuthGroup,
 
                     pDirNode->Type.Data.ShortNameTreeEntry.HashIndex = AFSGenerateCRC( &uniShortName,
                                                                                        TRUE);
+
+                    AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                  AFS_TRACE_LEVEL_VERBOSE,
+                                  "AFSEnumerateDirectory Initialized short name %wZ for DE %p for %wZ\n",
+                                  &uniShortName,
+                                  pDirNode,
+                                  &pDirNode->NameInformation.FileName);
                 }
 
                 //
@@ -279,10 +286,22 @@ AFSEnumerateDirectory( IN GUID *AuthGroup,
                 {
 
                     ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.CaseSensitiveTreeHead = pDirNode;
+
+                    AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                  AFS_TRACE_LEVEL_VERBOSE,
+                                  "AFSEnumerateDirectory Insert DE %p to head of case sensitive tree for %wZ\n",
+                                  pDirNode,
+                                  &pDirNode->NameInformation.FileName);
                 }
                 else
                 {
 
+                    AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                  AFS_TRACE_LEVEL_VERBOSE,
+                                  "AFSEnumerateDirectory Insert DE %p to case sensitive tree for %wZ\n",
+                                  pDirNode,
+                                  &pDirNode->NameInformation.FileName);
+
                     AFSInsertCaseSensitiveDirEntry( ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.CaseSensitiveTreeHead,
                                                     pDirNode);
                 }
@@ -290,6 +309,12 @@ AFSEnumerateDirectory( IN GUID *AuthGroup,
                 if( ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.CaseInsensitiveTreeHead == NULL)
                 {
 
+                    AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                  AFS_TRACE_LEVEL_VERBOSE,
+                                  "AFSEnumerateDirectory Insert DE %p to head of case insensitive tree for %wZ\n",
+                                  pDirNode,
+                                  &pDirNode->NameInformation.FileName);
+
                     ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.CaseInsensitiveTreeHead = pDirNode;
 
                     SetFlag( pDirNode->Flags, AFS_DIR_ENTRY_CASE_INSENSTIVE_LIST_HEAD);
@@ -297,6 +322,12 @@ AFSEnumerateDirectory( IN GUID *AuthGroup,
                 else
                 {
 
+                    AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                  AFS_TRACE_LEVEL_VERBOSE,
+                                  "AFSEnumerateDirectory Insert DE %p to case insensitive tree for %wZ\n",
+                                  pDirNode,
+                                  &pDirNode->NameInformation.FileName);
+
                     AFSInsertCaseInsensitiveDirEntry( ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.CaseInsensitiveTreeHead,
                                                       pDirNode);
                 }
@@ -340,11 +371,23 @@ AFSEnumerateDirectory( IN GUID *AuthGroup,
                     if( ObjectInfoCB->Specific.Directory.ShortNameTree == NULL)
                     {
 
+                        AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                      AFS_TRACE_LEVEL_VERBOSE,
+                                      "AFSEnumerateDirectory Insert DE %p to head of shortname tree for %wZ\n",
+                                      pDirNode,
+                                      &pDirNode->NameInformation.FileName);
+
                         ObjectInfoCB->Specific.Directory.ShortNameTree = pDirNode;
                     }
                     else
                     {
 
+                        AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                      AFS_TRACE_LEVEL_VERBOSE,
+                                      "AFSEnumerateDirectory Insert DE %p to shortname tree for %wZ\n",
+                                      pDirNode,
+                                      &pDirNode->NameInformation.FileName);
+
                         AFSInsertShortNameDirEntry( ObjectInfoCB->Specific.Directory.ShortNameTree,
                                                     pDirNode);
                     }
@@ -818,6 +861,13 @@ AFSVerifyDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB,
 
                     pDirNode->Type.Data.ShortNameTreeEntry.HashIndex = AFSGenerateCRC( &uniShortName,
                                                                                        TRUE);
+
+                    AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                  AFS_TRACE_LEVEL_VERBOSE,
+                                  "AFSVerifyDirectoryContent Initialized short name %wZ for DE %p for %wZ\n",
+                                  &uniShortName,
+                                  pDirNode,
+                                  &pDirNode->NameInformation.FileName);
                 }
 
                 //
@@ -830,12 +880,24 @@ AFSVerifyDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB,
                 {
 
                     ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.CaseSensitiveTreeHead = pDirNode;
+
+                    AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                  AFS_TRACE_LEVEL_VERBOSE,
+                                  "AFSVerifyDirectoryContent Insert DE %p to head of case sensitive tree for %wZ\n",
+                                  pDirNode,
+                                  &pDirNode->NameInformation.FileName);
                 }
                 else
                 {
 
                     AFSInsertCaseSensitiveDirEntry( ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.CaseSensitiveTreeHead,
                                                     pDirNode);
+
+                    AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                  AFS_TRACE_LEVEL_VERBOSE,
+                                  "AFSVerifyDirectoryContent Insert DE %p to case sensitive tree for %wZ\n",
+                                  pDirNode,
+                                  &pDirNode->NameInformation.FileName);
                 }
 
                 if( ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.CaseInsensitiveTreeHead == NULL)
@@ -844,12 +906,24 @@ AFSVerifyDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB,
                     ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.CaseInsensitiveTreeHead = pDirNode;
 
                     SetFlag( pDirNode->Flags, AFS_DIR_ENTRY_CASE_INSENSTIVE_LIST_HEAD);
+
+                    AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                  AFS_TRACE_LEVEL_VERBOSE,
+                                  "AFSVerifyDirectoryContent Insert DE %p to head of case insensitive tree for %wZ\n",
+                                  pDirNode,
+                                  &pDirNode->NameInformation.FileName);
                 }
                 else
                 {
 
                     AFSInsertCaseInsensitiveDirEntry( ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.CaseInsensitiveTreeHead,
                                                       pDirNode);
+
+                    AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                  AFS_TRACE_LEVEL_VERBOSE,
+                                  "AFSVerifyDirectoryContent Insert DE %p to case insensitive tree for %wZ\n",
+                                  pDirNode,
+                                  &pDirNode->NameInformation.FileName);
                 }
 
                 if( ObjectInfoCB->Specific.Directory.DirectoryNodeListHead == NULL)
@@ -892,12 +966,24 @@ AFSVerifyDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB,
                     {
 
                         ObjectInfoCB->Specific.Directory.ShortNameTree = pDirNode;
+
+                        AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                      AFS_TRACE_LEVEL_VERBOSE,
+                                      "AFSVerifyDirectoryContent Insert DE %p to head of shortname tree for %wZ\n",
+                                      pDirNode,
+                                      &pDirNode->NameInformation.FileName);
                     }
                     else
                     {
 
                         AFSInsertShortNameDirEntry( ObjectInfoCB->Specific.Directory.ShortNameTree,
                                                     pDirNode);
+
+                        AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                      AFS_TRACE_LEVEL_VERBOSE,
+                                      "AFSVerifyDirectoryContent Insert DE %p to shortname tree for %wZ\n",
+                                      pDirNode,
+                                      &pDirNode->NameInformation.FileName);
                     }
                 }
 
@@ -1151,6 +1237,13 @@ AFSNotifyFileCreate( IN GUID            *AuthGroup,
 
             pDirNode->Type.Data.ShortNameTreeEntry.HashIndex = AFSGenerateCRC( &uniShortName,
                                                                                TRUE);
+
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                          AFS_TRACE_LEVEL_VERBOSE,
+                          "AFSNotifyFileCreate Initialized short name %wZ for DE %p for %wZ\n",
+                          &uniShortName,
+                          pDirNode,
+                          &pDirNode->NameInformation.FileName);
         }
 
         //
index d03c63d..2ace0a0 100644 (file)
@@ -1031,7 +1031,7 @@ AFSInitDirEntry( IN AFSObjectInfoCB *ParentObjectInfo,
 
             bAllocatedObjectCB = TRUE;
 
-            AFSDbgLogMsg( AFS_SUBSYSTEM_CLEANUP_PROCESSING,
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
                           AFS_TRACE_LEVEL_VERBOSE,
                           "AFSInitDirEntry initialized object %08lX Parent Object %08lX for %wZ\n",
                           pObjectInfoCB,
@@ -1128,6 +1128,16 @@ AFSInitDirEntry( IN AFSObjectInfoCB *ParentObjectInfo,
                                                                            TRUE);
         }
 
+        AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                      AFS_TRACE_LEVEL_VERBOSE,
+                      "AFSInitDirEntry Initialized DE %p for %wZ in parent FID %08lX-%08lX-%08lX-%08lX\n",
+                      pDirNode,
+                      FileName,
+                      ParentObjectInfo->FileId.Cell,
+                      ParentObjectInfo->FileId.Volume,
+                      ParentObjectInfo->FileId.Vnode,
+                      ParentObjectInfo->FileId.Unique);
+
         if( TargetName != NULL &&
             TargetName->Length > 0)
         {
@@ -6973,6 +6983,12 @@ AFSRemoveNameEntry( IN AFSObjectInfoCB *ParentObjectInfo,
         if( BooleanFlagOn( DirEntry->Flags, AFS_DIR_ENTRY_NOT_IN_PARENT_TREE))
         {
 
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                          AFS_TRACE_LEVEL_VERBOSE,
+                          "AFSRemoveNameEntry DE %p for %wZ has NOT_IN flag set\n",
+                          DirEntry,
+                          &DirEntry->NameInformation.FileName);
+
             try_return( ntStatus);
         }
 
@@ -6982,9 +6998,21 @@ AFSRemoveNameEntry( IN AFSObjectInfoCB *ParentObjectInfo,
         // Remove the entry from the parent tree
         //
 
+        AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                      AFS_TRACE_LEVEL_VERBOSE,
+                      "AFSRemoveNameEntry DE %p for %wZ removing from case sensitive tree\n",
+                      DirEntry,
+                      &DirEntry->NameInformation.FileName);
+
         AFSRemoveCaseSensitiveDirEntry( &ParentObjectInfo->Specific.Directory.DirectoryNodeHdr.CaseSensitiveTreeHead,
                                         DirEntry);
 
+        AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                      AFS_TRACE_LEVEL_VERBOSE,
+                      "AFSRemoveNameEntry DE %p for %wZ removing from case insensitive tree\n",
+                      DirEntry,
+                      &DirEntry->NameInformation.FileName);
+
         AFSRemoveCaseInsensitiveDirEntry( &ParentObjectInfo->Specific.Directory.DirectoryNodeHdr.CaseInsensitiveTreeHead,
                                           DirEntry);
 
@@ -6996,10 +7024,22 @@ AFSRemoveNameEntry( IN AFSObjectInfoCB *ParentObjectInfo,
             // From the short name tree
             //
 
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                          AFS_TRACE_LEVEL_VERBOSE,
+                          "AFSRemoveNameEntry DE %p for %wZ removing from shortname tree\n",
+                          DirEntry,
+                          &DirEntry->NameInformation.FileName);
+
             AFSRemoveShortNameDirEntry( &ParentObjectInfo->Specific.Directory.ShortNameTree,
                                         DirEntry);
         }
 
+        AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                      AFS_TRACE_LEVEL_VERBOSE,
+                      "AFSRemoveNameEntry DE %p for %wZ setting NOT_IN flag\n",
+                      DirEntry,
+                      &DirEntry->NameInformation.FileName);
+
         SetFlag( DirEntry->Flags, AFS_DIR_ENTRY_NOT_IN_PARENT_TREE);
 
 try_exit:
index 805be3c..a2aa32d 100644 (file)
@@ -2053,18 +2053,36 @@ AFSInsertDirectoryNode( IN AFSObjectInfoCB *ParentObjectInfo,
         // Insert the node into the directory node tree
         //
 
+        AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                      AFS_TRACE_LEVEL_VERBOSE,
+                      "AFSInsertDirectoryNode Insert DE %p for %wZ Clearing NOT_IN flag\n",
+                      DirEntry,
+                      &DirEntry->NameInformation.FileName);
+
         ClearFlag( DirEntry->Flags, AFS_DIR_ENTRY_NOT_IN_PARENT_TREE);
 
         if( ParentObjectInfo->Specific.Directory.DirectoryNodeHdr.CaseSensitiveTreeHead == NULL)
         {
 
             ParentObjectInfo->Specific.Directory.DirectoryNodeHdr.CaseSensitiveTreeHead = DirEntry;
+
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                          AFS_TRACE_LEVEL_VERBOSE,
+                          "AFSInsertDirectoryNode Insert DE %p to head of case sensitive tree for %wZ\n",
+                          DirEntry,
+                          &DirEntry->NameInformation.FileName);
         }
         else
         {
 
             AFSInsertCaseSensitiveDirEntry( ParentObjectInfo->Specific.Directory.DirectoryNodeHdr.CaseSensitiveTreeHead,
                                             DirEntry);
+
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                          AFS_TRACE_LEVEL_VERBOSE,
+                          "AFSInsertDirectoryNode Insert DE %p to case sensitive tree for %wZ\n",
+                          DirEntry,
+                          &DirEntry->NameInformation.FileName);
         }
 
         if( ParentObjectInfo->Specific.Directory.DirectoryNodeHdr.CaseInsensitiveTreeHead == NULL)
@@ -2073,12 +2091,24 @@ AFSInsertDirectoryNode( IN AFSObjectInfoCB *ParentObjectInfo,
             ParentObjectInfo->Specific.Directory.DirectoryNodeHdr.CaseInsensitiveTreeHead = DirEntry;
 
             SetFlag( DirEntry->Flags, AFS_DIR_ENTRY_CASE_INSENSTIVE_LIST_HEAD);
+
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                          AFS_TRACE_LEVEL_VERBOSE,
+                          "AFSInsertDirectoryNode Insert DE %p to head of case insensitive tree for %wZ\n",
+                          DirEntry,
+                          &DirEntry->NameInformation.FileName);
         }
         else
         {
 
             AFSInsertCaseInsensitiveDirEntry( ParentObjectInfo->Specific.Directory.DirectoryNodeHdr.CaseInsensitiveTreeHead,
                                               DirEntry);
+
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                          AFS_TRACE_LEVEL_VERBOSE,
+                          "AFSInsertDirectoryNode Insert DE %p to case sensitive tree for %wZ\n",
+                          DirEntry,
+                          &DirEntry->NameInformation.FileName);
         }
 
         //
@@ -2092,12 +2122,24 @@ AFSInsertDirectoryNode( IN AFSObjectInfoCB *ParentObjectInfo,
             {
 
                 ParentObjectInfo->Specific.Directory.ShortNameTree = DirEntry;
+
+                AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                              AFS_TRACE_LEVEL_VERBOSE,
+                              "AFSInsertDirectoryNode Insert DE %p to head of shortname tree for %wZ\n",
+                              DirEntry,
+                              &DirEntry->NameInformation.FileName);
             }
             else
             {
 
                 AFSInsertShortNameDirEntry( ParentObjectInfo->Specific.Directory.ShortNameTree,
                                             DirEntry);
+
+                AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                              AFS_TRACE_LEVEL_VERBOSE,
+                              "AFSInsertDirectoryNode Insert DE %p to shortname tree for %wZ\n",
+                              DirEntry,
+                              &DirEntry->NameInformation.FileName);
             }
         }
 
@@ -2254,6 +2296,16 @@ AFSRemoveDirNodeFromParent( IN AFSObjectInfoCB *ParentObjectInfo,
             AFSRemoveNameEntry( ParentObjectInfo,
                                 DirEntry);
         }
+        else
+        {
+
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                          AFS_TRACE_LEVEL_VERBOSE,
+                          "AFSRemoveDirNodeFromParent DE %p for %wZ NOT removing entry due to flag set\n",
+                          DirEntry,
+                          &DirEntry->NameInformation.FileName);
+
+        }
 
         if( RemoveFromEnumList &&
             BooleanFlagOn( DirEntry->Flags, AFS_DIR_ENTRY_INSERTED_ENUM_LIST))