Windows: afsredirlib log messages
[openafs.git] / src / WINNT / afsrdr / kernel / lib / AFSCommSupport.cpp
index df5ce4b..4c18cc6 100644 (file)
@@ -832,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;
@@ -884,10 +884,10 @@ AFSVerifyDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB,
                                       "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,
@@ -906,10 +906,10 @@ AFSVerifyDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB,
                                       "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,
+                                      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,
@@ -1023,7 +1023,7 @@ AFSVerifyDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB,
                     {
                         AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
                                       AFS_TRACE_LEVEL_VERBOSE,
-                                      "AFSVerifyDirectoryContent Failed to nsert DE %p to case sensitive tree for %wZ\n",
+                                      "AFSVerifyDirectoryContent Failed to insert DE %p to case sensitive tree for %wZ\n",
                                       pDirNode,
                                       &pDirNode->NameInformation.FileName);
 
@@ -1325,8 +1325,6 @@ AFSNotifyFileCreate( IN GUID            *AuthGroup,
                                             ulCRC,
                                             &pDirNode);
 
-            AFSReleaseResource( ParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock);
-
             if( pDirNode != NULL)
             {
 
@@ -1335,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
@@ -1532,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
     {
@@ -1555,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,
@@ -1611,6 +1617,7 @@ try_exit:
 
 NTSTATUS
 AFSNotifyRename( IN AFSObjectInfoCB *ObjectInfo,
+                 IN GUID            *AuthGroup,
                  IN AFSObjectInfoCB *ParentObjectInfo,
                  IN AFSObjectInfoCB *TargetParentObjectInfo,
                  IN AFSDirectoryCB *DirectoryCB,
@@ -1622,7 +1629,6 @@ AFSNotifyRename( IN AFSObjectInfoCB *ObjectInfo,
     AFSFileRenameCB *pRenameCB = NULL;
     AFSFileRenameResultCB *pRenameResultCB = NULL;
     ULONG ulResultLen = 0;
-    GUID *pAuthGroup = NULL;
 
     __Enter
     {
@@ -1654,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
         //
@@ -1669,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,
@@ -2031,7 +2032,6 @@ AFSNotifyPipeTransceive( IN AFSCcb *Ccb,
     void *pInputSystemBuffer = NULL, *pOutputSystemBuffer = NULL;
     ULONG ulBufferLength = OutputLength;
     AFSPipeIORequestCB *pIoRequest = NULL;
-    GUID *pAuthGroup = NULL;
 
     __Enter
     {
@@ -2084,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
         //
@@ -2097,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,
@@ -2161,7 +2156,6 @@ AFSNotifySetPipeInfo( IN AFSCcb *Ccb,
 
     NTSTATUS ntStatus = STATUS_SUCCESS;
     AFSPipeInfoRequestCB *pInfoRequest = NULL;
-    GUID *pAuthGroup = NULL;
 
     __Enter
     {
@@ -2192,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,
@@ -2246,7 +2235,6 @@ AFSNotifyQueryPipeInfo( IN AFSCcb *Ccb,
     NTSTATUS ntStatus = STATUS_SUCCESS;
     AFSPipeInfoRequestCB stInfoRequest;
     ULONG ulBytesProcessed = 0;
-    GUID *pAuthGroup = NULL;
 
     __Enter
     {
@@ -2264,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,