Windows: afsredirlib log messages
[openafs.git] / src / WINNT / afsrdr / kernel / lib / AFSCommSupport.cpp
index ae95300..4c18cc6 100644 (file)
@@ -263,10 +263,35 @@ AFSEnumerateDirectory( IN GUID *AuthGroup,
                     //
 
                     uniShortName.Length = pDirNode->NameInformation.ShortNameLength;
+                    uniShortName.MaximumLength = uniShortName.Length;
                     uniShortName.Buffer = pDirNode->NameInformation.ShortName;
 
-                    pDirNode->Type.Data.ShortNameTreeEntry.HashIndex = AFSGenerateCRC( &uniShortName,
-                                                                                       TRUE);
+                    if( !RtlIsNameLegalDOS8Dot3( &pDirNode->NameInformation.FileName,
+                                                 NULL,
+                                                 NULL))
+                    {
+
+                        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 FID %08lX-%08lX-%08lX-%08lX\n",
+                                      &uniShortName,
+                                      pDirNode,
+                                      &pDirNode->NameInformation.FileName,
+                                      pCurrentDirEntry->FileId.Cell,
+                                      pCurrentDirEntry->FileId.Volume,
+                                      pCurrentDirEntry->FileId.Vnode,
+                                      pCurrentDirEntry->FileId.Unique);
+                    }
+                    else
+                    {
+                        pDirNode->NameInformation.ShortNameLength = 0;
+
+                        RtlZeroMemory( pDirNode->NameInformation.ShortName,
+                                       (12 * sizeof( WCHAR)));
+                    }
                 }
 
                 //
@@ -279,17 +304,59 @@ 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
                 {
 
-                    AFSInsertCaseSensitiveDirEntry( ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.CaseSensitiveTreeHead,
-                                                    pDirNode);
+                    AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                  AFS_TRACE_LEVEL_VERBOSE,
+                                  "AFSEnumerateDirectory Insert DE %p to case sensitive tree for %wZ\n",
+                                  pDirNode,
+                                  &pDirNode->NameInformation.FileName);
+
+                    if( !NT_SUCCESS( AFSInsertCaseSensitiveDirEntry( ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.CaseSensitiveTreeHead,
+                                                                     pDirNode)))
+                    {
+
+                        //
+                        // Delete this dir entry and continue on
+                        //
+
+                        AFSDeleteDirEntry( ObjectInfoCB,
+                                           pDirNode);
+
+                        pCurrentDirEntry = (AFSDirEnumEntry *)((char *)pCurrentDirEntry + ulEntryLength);
+
+                        if( ulResultLen >= ulEntryLength)
+                        {
+                            ulResultLen -= ulEntryLength;
+                        }
+                        else
+                        {
+                            ulResultLen = 0;
+                        }
+
+                        continue;
+                    }
                 }
 
+                ClearFlag( pDirNode->Flags, AFS_DIR_ENTRY_NOT_IN_PARENT_TREE);
+
                 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 +364,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,13 +413,30 @@ 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;
+
+                        SetFlag( pDirNode->Flags, AFS_DIR_ENTRY_INSERTED_SHORT_NAME);
                     }
                     else
                     {
 
-                        AFSInsertShortNameDirEntry( ObjectInfoCB->Specific.Directory.ShortNameTree,
-                                                    pDirNode);
+                        if( NT_SUCCESS( AFSInsertShortNameDirEntry( ObjectInfoCB->Specific.Directory.ShortNameTree,
+                                                                    pDirNode)))
+                        {
+                            SetFlag( pDirNode->Flags, AFS_DIR_ENTRY_INSERTED_SHORT_NAME);
+
+                            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                          AFS_TRACE_LEVEL_VERBOSE,
+                                          "AFSEnumerateDirectory Insert DE %p to shortname tree for %wZ\n",
+                                          pDirNode,
+                                          &pDirNode->NameInformation.FileName);
+                        }
                     }
                 }
 
@@ -674,6 +764,46 @@ AFSVerifyDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB,
 
                             SetFlag( pDirNode->Flags, AFS_DIR_ENTRY_VALID);
 
+                            if( pCurrentDirEntry->ShortNameLength > 0 &&
+                                pDirNode->NameInformation.ShortNameLength > 0)
+                            {
+                                AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                              AFS_TRACE_LEVEL_VERBOSE,
+                                              "AFSVerifyDirectoryContent Verified entry %wZ (%wZ) old short name %S New short name %S\n",
+                                              &uniDirName,
+                                              &pDirNode->NameInformation.FileName,
+                                              pDirNode->NameInformation.ShortName,
+                                              pCurrentDirEntry->ShortName);
+                            }
+                            else if( pCurrentDirEntry->ShortNameLength == 0 &&
+                                     pDirNode->NameInformation.ShortNameLength > 0)
+                            {
+                                AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                              AFS_TRACE_LEVEL_VERBOSE,
+                                              "AFSVerifyDirectoryContent Verified entry %wZ (%wZ) old short name %S New short name NULL\n",
+                                              &uniDirName,
+                                              &pDirNode->NameInformation.FileName,
+                                              pDirNode->NameInformation.ShortName);
+                            }
+                            else if( pCurrentDirEntry->ShortNameLength > 0 &&
+                                     pDirNode->NameInformation.ShortNameLength == 0)
+                            {
+                                AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                              AFS_TRACE_LEVEL_VERBOSE,
+                                              "AFSVerifyDirectoryContent Verified entry %wZ (%wZ) old short name NULL New short name %S\n",
+                                              &uniDirName,
+                                              &pDirNode->NameInformation.FileName,
+                                              pCurrentDirEntry->ShortName);
+                            }
+                            else
+                            {
+                                AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                              AFS_TRACE_LEVEL_VERBOSE,
+                                              "AFSVerifyDirectoryContent Verified entry %wZ (%wZ) old short name NULL New short name NULL\n",
+                                              &uniDirName,
+                                              &pDirNode->NameInformation.FileName);
+                            }
+
                             AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
                                           AFS_TRACE_LEVEL_VERBOSE,
                                           "AFSVerifyDirectoryContent Verified entry %wZ for parent FID %08lX-%08lX-%08lX-%08lX\n",
@@ -702,10 +832,10 @@ AFSVerifyDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB,
                                                   AFS_TRACE_LEVEL_VERBOSE,
                                                   "AFSVerifyDirectoryContent Setting VERIFY on entry %wZ for FID %08lX-%08lX-%08lX-%08lX\n",
                                                   &uniDirName,
-                                                  ObjectInfoCB->FileId.Cell,
-                                                  ObjectInfoCB->FileId.Volume,
-                                                  ObjectInfoCB->FileId.Vnode,
-                                                  ObjectInfoCB->FileId.Unique);
+                                                  pObjectInfo->FileId.Cell,
+                                                  pObjectInfo->FileId.Volume,
+                                                  pObjectInfo->FileId.Vnode,
+                                                  pObjectInfo->FileId.Unique);
 
                                     SetFlag( pObjectInfo->Flags, AFS_OBJECT_FLAGS_VERIFY);
                                     pObjectInfo->DataVersion.QuadPart = (ULONGLONG)-1;
@@ -734,7 +864,8 @@ AFSVerifyDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB,
 
                     AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
                                   AFS_TRACE_LEVEL_VERBOSE,
-                                  "AFSVerifyDirectoryContent Processing dir entry %wZ with different FID, same name in parent FID %08lX-%08lX-%08lX-%08lX\n",
+                                  "AFSVerifyDirectoryContent Processing dir entry %p %wZ with different FID, same name in parent FID %08lX-%08lX-%08lX-%08lX\n",
+                                  pDirNode,
                                   &pDirNode->NameInformation.FileName,
                                   ObjectInfoCB->FileId.Cell,
                                   ObjectInfoCB->FileId.Volume,
@@ -750,12 +881,17 @@ AFSVerifyDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB,
 
                         AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
                                       AFS_TRACE_LEVEL_VERBOSE,
-                                      "AFSVerifyDirectoryContent Deleting dir entry %wZ from parent FID %08lX-%08lX-%08lX-%08lX\n",
+                                      "AFSVerifyDirectoryContent Different FIDs - Deleting DE %p for %wZ Old FID %08lX-%08lX-%08lX-%08lX New FID %08lX-%08lX-%08lX-%08lX\n",
+                                      pDirNode,
                                       &pDirNode->NameInformation.FileName,
-                                      ObjectInfoCB->FileId.Cell,
-                                      ObjectInfoCB->FileId.Volume,
-                                      ObjectInfoCB->FileId.Vnode,
-                                      ObjectInfoCB->FileId.Unique);
+                                      pDirNode->ObjectInformation->FileId.Cell,
+                                      pDirNode->ObjectInformation->FileId.Volume,
+                                      pDirNode->ObjectInformation->FileId.Vnode,
+                                      pDirNode->ObjectInformation->FileId.Unique,
+                                      pCurrentDirEntry->FileId.Cell,
+                                      pCurrentDirEntry->FileId.Volume,
+                                      pCurrentDirEntry->FileId.Vnode,
+                                      pCurrentDirEntry->FileId.Unique);
 
                         AFSDeleteDirEntry( ObjectInfoCB,
                                            pDirNode);
@@ -763,17 +899,21 @@ AFSVerifyDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB,
                     else
                     {
 
+                        SetFlag( pDirNode->Flags, AFS_DIR_ENTRY_DELETED);
+
                         AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
                                       AFS_TRACE_LEVEL_VERBOSE,
-                                      "AFSVerifyDirectoryContent Setting dir entry %p name %wZ DELETED in parent FID %08lX-%08lX-%08lX-%08lX\n",
+                                      "AFSVerifyDirectoryContent Different FIDs - removing DE %p for %wZ Old FID %08lX-%08lX-%08lX-%08lX New FID %08lX-%08lX-%08lX-%08lX\n",
                                       pDirNode,
                                       &pDirNode->NameInformation.FileName,
-                                      ObjectInfoCB->FileId.Cell,
-                                      ObjectInfoCB->FileId.Volume,
-                                      ObjectInfoCB->FileId.Vnode,
-                                      ObjectInfoCB->FileId.Unique);
-
-                        SetFlag( pDirNode->Flags, AFS_DIR_ENTRY_DELETED);
+                                      pDirNode->ObjectInformation->FileId.Cell,
+                                      pDirNode->ObjectInformation->FileId.Volume,
+                                      pDirNode->ObjectInformation->FileId.Vnode,
+                                      pDirNode->ObjectInformation->FileId.Unique,
+                                      pCurrentDirEntry->FileId.Cell,
+                                      pCurrentDirEntry->FileId.Volume,
+                                      pCurrentDirEntry->FileId.Vnode,
+                                      pCurrentDirEntry->FileId.Unique);
 
                         AFSRemoveNameEntry( ObjectInfoCB,
                                             pDirNode);
@@ -814,10 +954,48 @@ AFSVerifyDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB,
                     //
 
                     uniShortName.Length = pDirNode->NameInformation.ShortNameLength;
+                    uniShortName.MaximumLength = uniShortName.Length;
                     uniShortName.Buffer = pDirNode->NameInformation.ShortName;
 
-                    pDirNode->Type.Data.ShortNameTreeEntry.HashIndex = AFSGenerateCRC( &uniShortName,
-                                                                                       TRUE);
+                    if( !RtlIsNameLegalDOS8Dot3( &pDirNode->NameInformation.FileName,
+                                                 NULL,
+                                                 NULL))
+                    {
+
+                        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 FID %08lX-%08lX-%08lX-%08lX\n",
+                                      &uniShortName,
+                                      pDirNode,
+                                      &pDirNode->NameInformation.FileName,
+                                      pCurrentDirEntry->FileId.Cell,
+                                      pCurrentDirEntry->FileId.Volume,
+                                      pCurrentDirEntry->FileId.Vnode,
+                                      pCurrentDirEntry->FileId.Unique);
+                    }
+                    else
+                    {
+                        pDirNode->NameInformation.ShortNameLength = 0;
+
+                        RtlZeroMemory( pDirNode->NameInformation.ShortName,
+                                       (12 * sizeof( WCHAR)));
+                    }
+                }
+                else
+                {
+
+                    AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                  AFS_TRACE_LEVEL_VERBOSE,
+                                  "AFSVerifyDirectoryContent NO short name for DE %p for %wZ FID %08lX-%08lX-%08lX-%08lX\n",
+                                  pDirNode,
+                                  &pDirNode->NameInformation.FileName,
+                                  pCurrentDirEntry->FileId.Cell,
+                                  pCurrentDirEntry->FileId.Volume,
+                                  pCurrentDirEntry->FileId.Vnode,
+                                  pCurrentDirEntry->FileId.Unique);
                 }
 
                 //
@@ -830,26 +1008,81 @@ 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);
+                    if( !NT_SUCCESS( AFSInsertCaseSensitiveDirEntry( ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.CaseSensitiveTreeHead,
+                                                                     pDirNode)))
+                    {
+                        AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                      AFS_TRACE_LEVEL_VERBOSE,
+                                      "AFSVerifyDirectoryContent Failed to insert DE %p to case sensitive tree for %wZ\n",
+                                      pDirNode,
+                                      &pDirNode->NameInformation.FileName);
+
+                        //
+                        // Delete this dir entry and continue on
+                        //
+
+                        AFSDeleteDirEntry( ObjectInfoCB,
+                                           pDirNode);
+
+                        pCurrentDirEntry = (AFSDirEnumEntry *)((char *)pCurrentDirEntry + ulEntryLength);
+
+                        if( ulResultLen >= ulEntryLength)
+                        {
+                            ulResultLen -= ulEntryLength;
+                        }
+                        else
+                        {
+                            ulResultLen = 0;
+                        }
+
+                        continue;
+                    }
+                    else
+                    {
+                        AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                      AFS_TRACE_LEVEL_VERBOSE,
+                                      "AFSVerifyDirectoryContent Insert DE %p to case sensitive tree for %wZ\n",
+                                      pDirNode,
+                                      &pDirNode->NameInformation.FileName);
+                    }
                 }
 
+                ClearFlag( pDirNode->Flags, AFS_DIR_ENTRY_NOT_IN_PARENT_TREE);
+
                 if( ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.CaseInsensitiveTreeHead == NULL)
                 {
 
                     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 +1125,38 @@ 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);
+
+                        SetFlag( pDirNode->Flags, AFS_DIR_ENTRY_INSERTED_SHORT_NAME);
                     }
                     else
                     {
 
-                        AFSInsertShortNameDirEntry( ObjectInfoCB->Specific.Directory.ShortNameTree,
-                                                    pDirNode);
+                        if( !NT_SUCCESS( AFSInsertShortNameDirEntry( ObjectInfoCB->Specific.Directory.ShortNameTree,
+                                                                     pDirNode)))
+                        {
+                            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                          AFS_TRACE_LEVEL_VERBOSE,
+                                          "AFSVerifyDirectoryContent Failed to insert DE %p (%08lX) to shortname tree for %wZ\n",
+                                          pDirNode,
+                                          pDirNode->Type.Data.ShortNameTreeEntry.HashIndex,
+                                          &pDirNode->NameInformation.FileName);
+                        }
+                        else
+                        {
+                            SetFlag( pDirNode->Flags, AFS_DIR_ENTRY_INSERTED_SHORT_NAME);
+
+                            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                                          AFS_TRACE_LEVEL_VERBOSE,
+                                          "AFSVerifyDirectoryContent Insert DE %p to shortname tree for %wZ\n",
+                                          pDirNode,
+                                          &pDirNode->NameInformation.FileName);
+                        }
                     }
                 }
 
@@ -1066,8 +1325,6 @@ AFSNotifyFileCreate( IN GUID            *AuthGroup,
                                             ulCRC,
                                             &pDirNode);
 
-            AFSReleaseResource( ParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock);
-
             if( pDirNode != NULL)
             {
 
@@ -1076,11 +1333,24 @@ AFSNotifyFileCreate( IN GUID            *AuthGroup,
                               "AFSNotifyFileCreate Located dir entry for file %wZ\n",
                               FileName);
 
+                InterlockedIncrement( &pDirNode->OpenReferenceCount);
+
+                AFSDbgLogMsg( AFS_SUBSYSTEM_DIRENTRY_REF_COUNTING,
+                              AFS_TRACE_LEVEL_VERBOSE,
+                              "AFSNotifyFileCreate Increment count on %wZ DE %p Cnt %d\n",
+                              &pDirNode->NameInformation.FileName,
+                              pDirNode,
+                              pDirNode->OpenReferenceCount);
+
                 *DirNode = pDirNode;
 
+                AFSReleaseResource( ParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock);
+
                 try_return( ntStatus = STATUS_REPARSE);
             }
 
+            AFSReleaseResource( ParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock);
+
             //
             // We are unsure of our current data so set the verify flag. It may already be set
             // but no big deal to reset it
@@ -1151,6 +1421,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);
         }
 
         //
@@ -1166,11 +1443,6 @@ try_exit:
 
             AFSExFreePool( pResultCB);
         }
-
-        if( !NT_SUCCESS( ntStatus))
-        {
-
-        }
     }
 
     return ntStatus;
@@ -1271,14 +1543,14 @@ try_exit:
 
 NTSTATUS
 AFSNotifyDelete( IN AFSDirectoryCB *DirectoryCB,
-                 IN BOOLEAN CheckOnly)
+                 IN GUID           *AuthGroup,
+                 IN BOOLEAN         CheckOnly)
 {
     NTSTATUS ntStatus = STATUS_SUCCESS;
     ULONG ulResultLen = 0;
     AFSFileDeleteCB stDelete;
     AFSFileDeleteResultCB stDeleteResult;
     ULONG ulRequestFlags = AFS_REQUEST_FLAG_SYNCHRONOUS;
-    GUID *pAuthGroup = NULL;
 
     __Enter
     {
@@ -1294,14 +1566,9 @@ AFSNotifyDelete( IN AFSDirectoryCB *DirectoryCB,
             ulRequestFlags |= AFS_REQUEST_FLAG_CHECK_ONLY;
         }
 
-        if( DirectoryCB->ObjectInformation->Fcb != NULL)
-        {
-            pAuthGroup = &DirectoryCB->ObjectInformation->Fcb->AuthGroup;
-        }
-
         ntStatus = AFSProcessRequest( AFS_REQUEST_TYPE_DELETE_FILE,
                                       ulRequestFlags,
-                                      pAuthGroup,
+                                      AuthGroup,
                                       &DirectoryCB->NameInformation.FileName,
                                       &DirectoryCB->ObjectInformation->FileId,
                                       &stDelete,
@@ -1334,7 +1601,7 @@ AFSNotifyDelete( IN AFSDirectoryCB *DirectoryCB,
             if( DirectoryCB->ObjectInformation->ParentObjectInformation->DataVersion.QuadPart != stDeleteResult.ParentDataVersion.QuadPart)
             {
 
-                DirectoryCB->ObjectInformation->ParentObjectInformation->Flags |= AFS_OBJECT_FLAGS_VERIFY;
+                SetFlag( DirectoryCB->ObjectInformation->ParentObjectInformation->Flags, AFS_OBJECT_FLAGS_VERIFY);
 
                 DirectoryCB->ObjectInformation->ParentObjectInformation->DataVersion.QuadPart = (ULONGLONG)-1;
             }
@@ -1350,6 +1617,7 @@ try_exit:
 
 NTSTATUS
 AFSNotifyRename( IN AFSObjectInfoCB *ObjectInfo,
+                 IN GUID            *AuthGroup,
                  IN AFSObjectInfoCB *ParentObjectInfo,
                  IN AFSObjectInfoCB *TargetParentObjectInfo,
                  IN AFSDirectoryCB *DirectoryCB,
@@ -1361,7 +1629,6 @@ AFSNotifyRename( IN AFSObjectInfoCB *ObjectInfo,
     AFSFileRenameCB *pRenameCB = NULL;
     AFSFileRenameResultCB *pRenameResultCB = NULL;
     ULONG ulResultLen = 0;
-    GUID *pAuthGroup = NULL;
 
     __Enter
     {
@@ -1393,11 +1660,6 @@ AFSNotifyRename( IN AFSObjectInfoCB *ObjectInfo,
                        TargetName->Buffer,
                        TargetName->Length);
 
-        if( ObjectInfo->Fcb != NULL)
-        {
-            pAuthGroup = &ObjectInfo->Fcb->AuthGroup;
-        }
-
         //
         // Use the same buffer for the result control block
         //
@@ -1408,7 +1670,7 @@ AFSNotifyRename( IN AFSObjectInfoCB *ObjectInfo,
 
         ntStatus = AFSProcessRequest( AFS_REQUEST_TYPE_RENAME_FILE,
                                       AFS_REQUEST_FLAG_SYNCHRONOUS,
-                                      pAuthGroup,
+                                      AuthGroup,
                                       &DirectoryCB->NameInformation.FileName,
                                       &ObjectInfo->FileId,
                                       pRenameCB,
@@ -1448,14 +1710,59 @@ AFSNotifyRename( IN AFSObjectInfoCB *ObjectInfo,
         if( DirectoryCB->NameInformation.ShortNameLength > 0)
         {
 
+            UNICODE_STRING uniShortName;
+
+            uniShortName.Length = DirectoryCB->NameInformation.ShortNameLength;
+            uniShortName.MaximumLength = uniShortName.Length;
+            uniShortName.Buffer = DirectoryCB->NameInformation.ShortName;
+
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                          AFS_TRACE_LEVEL_VERBOSE,
+                          "AFSNotifyRename Update old short name %wZ for DE %p for %wZ\n",
+                          &uniShortName,
+                          DirectoryCB,
+                          &DirectoryCB->NameInformation.FileName);
+
+            DirectoryCB->NameInformation.ShortNameLength = pRenameResultCB->DirEnum.ShortNameLength;
+
             RtlCopyMemory( DirectoryCB->NameInformation.ShortName,
                            pRenameResultCB->DirEnum.ShortName,
                            DirectoryCB->NameInformation.ShortNameLength);
+
+            uniShortName.Length = DirectoryCB->NameInformation.ShortNameLength;
+            uniShortName.MaximumLength = uniShortName.Length;
+            uniShortName.Buffer = DirectoryCB->NameInformation.ShortName;
+
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                          AFS_TRACE_LEVEL_VERBOSE,
+                          "AFSNotifyRename Initialized short name %wZ for DE %p for %wZ\n",
+                          &uniShortName,
+                          DirectoryCB,
+                          &DirectoryCB->NameInformation.FileName);
+        }
+        else
+        {
+
+            UNICODE_STRING uniShortName;
+
+            uniShortName.Length = DirectoryCB->NameInformation.ShortNameLength;
+            uniShortName.MaximumLength = uniShortName.Length;
+            uniShortName.Buffer = DirectoryCB->NameInformation.ShortName;
+
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                          AFS_TRACE_LEVEL_VERBOSE,
+                          "AFSNotifyRename Removing old short name %wZ for DE %p for %wZ\n",
+                          &uniShortName,
+                          DirectoryCB,
+                          &DirectoryCB->NameInformation.FileName);
+
+            DirectoryCB->NameInformation.ShortNameLength = 0;
+
+            DirectoryCB->Type.Data.ShortNameTreeEntry.HashIndex = 0;
         }
 
         if( UpdatedFID != NULL)
         {
-
             *UpdatedFID = pRenameResultCB->DirEnum.FileId;
         }
 
@@ -1643,7 +1950,16 @@ AFSEvaluateTargetByName( IN GUID *AuthGroup,
         // Pass back the dir enum entry
         //
 
-        *DirEnumEntry = pDirEnumCB;
+        if( DirEnumEntry != NULL)
+        {
+
+            *DirEnumEntry = pDirEnumCB;
+        }
+        else
+        {
+
+            AFSExFreePool( pDirEnumCB);
+        }
 
 try_exit:
 
@@ -1716,7 +2032,6 @@ AFSNotifyPipeTransceive( IN AFSCcb *Ccb,
     void *pInputSystemBuffer = NULL, *pOutputSystemBuffer = NULL;
     ULONG ulBufferLength = OutputLength;
     AFSPipeIORequestCB *pIoRequest = NULL;
-    GUID *pAuthGroup = NULL;
 
     __Enter
     {
@@ -1769,11 +2084,6 @@ AFSNotifyPipeTransceive( IN AFSCcb *Ccb,
             try_return( ntStatus = STATUS_INSUFFICIENT_RESOURCES);
         }
 
-        if( Ccb->DirectoryCB->ObjectInformation->Fcb != NULL)
-        {
-            pAuthGroup = &Ccb->DirectoryCB->ObjectInformation->Fcb->AuthGroup;
-        }
-
         //
         // Send the call to the service
         //
@@ -1782,7 +2092,7 @@ AFSNotifyPipeTransceive( IN AFSCcb *Ccb,
 
         ntStatus = AFSProcessRequest( AFS_REQUEST_TYPE_PIPE_TRANSCEIVE,
                                       AFS_REQUEST_FLAG_SYNCHRONOUS,
-                                      pAuthGroup,
+                                      &Ccb->AuthGroup,
                                       &Ccb->DirectoryCB->NameInformation.FileName,
                                       NULL,
                                       pIoRequest,
@@ -1846,7 +2156,6 @@ AFSNotifySetPipeInfo( IN AFSCcb *Ccb,
 
     NTSTATUS ntStatus = STATUS_SUCCESS;
     AFSPipeInfoRequestCB *pInfoRequest = NULL;
-    GUID *pAuthGroup = NULL;
 
     __Enter
     {
@@ -1877,18 +2186,13 @@ AFSNotifySetPipeInfo( IN AFSCcb *Ccb,
                        DataBuffer,
                        InputLength);
 
-        if( Ccb->DirectoryCB->ObjectInformation->Fcb != NULL)
-        {
-            pAuthGroup = &Ccb->DirectoryCB->ObjectInformation->Fcb->AuthGroup;
-        }
-
         //
         // Send the call to the service
         //
 
         ntStatus = AFSProcessRequest( AFS_REQUEST_TYPE_PIPE_SET_INFO,
                                       AFS_REQUEST_FLAG_SYNCHRONOUS,
-                                      pAuthGroup,
+                                      &Ccb->AuthGroup,
                                       &Ccb->DirectoryCB->NameInformation.FileName,
                                       NULL,
                                       pInfoRequest,
@@ -1931,7 +2235,6 @@ AFSNotifyQueryPipeInfo( IN AFSCcb *Ccb,
     NTSTATUS ntStatus = STATUS_SUCCESS;
     AFSPipeInfoRequestCB stInfoRequest;
     ULONG ulBytesProcessed = 0;
-    GUID *pAuthGroup = NULL;
 
     __Enter
     {
@@ -1949,18 +2252,13 @@ AFSNotifyQueryPipeInfo( IN AFSCcb *Ccb,
 
         ulBytesProcessed = OutputLength;
 
-        if( Ccb->DirectoryCB->ObjectInformation->Fcb != NULL)
-        {
-            pAuthGroup = &Ccb->DirectoryCB->ObjectInformation->Fcb->AuthGroup;
-        }
-
         //
         // Send the call to the service
         //
 
         ntStatus = AFSProcessRequest( AFS_REQUEST_TYPE_PIPE_QUERY_INFO,
                                       AFS_REQUEST_FLAG_SYNCHRONOUS,
-                                      pAuthGroup,
+                                      &Ccb->AuthGroup,
                                       &Ccb->DirectoryCB->NameInformation.FileName,
                                       NULL,
                                       &stInfoRequest,