Windows: Missing DirEntry Ref incr AFSLocateName
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 26 Nov 2012 12:10:05 +0000 (07:10 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Thu, 29 Nov 2012 23:49:54 +0000 (15:49 -0800)
In the STATUS_NAME_COLLISION error path the DirEntry refcnt must
be incremented because it will be decremented before exit from
AFSLocateName().

Change-Id: I7cf976afa8e62d0d9803549b64a5d0dae27cd9b1
Reviewed-on: http://gerrit.openafs.org/8518
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

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

index c4405a2..0f22bba 100644 (file)
@@ -1518,6 +1518,20 @@ AFSLocateNameEntry( IN GUID *AuthGroup,
                             pDirEntry->CaseInsensitiveList.fLink != NULL)
                         {
 
+                            //
+                            // Increment our dir entry ref count since we will decrement it on exit
+                            //
+
+                            lCount = InterlockedIncrement( &pDirEntry->OpenReferenceCount);
+
+                            AFSDbgLogMsg( AFS_SUBSYSTEM_DIRENTRY_REF_COUNTING,
+                                          AFS_TRACE_LEVEL_VERBOSE,
+                                          "AFSLocateNameEntry Increment5 count on %wZ DE %p Ccb %p Cnt %d\n",
+                                          &pDirEntry->NameInformation.FileName,
+                                          pDirEntry,
+                                          NULL,
+                                          lCount);
+
                             AFSReleaseResource( pParentDirEntry->ObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock);
 
                             try_return(ntStatus = STATUS_OBJECT_NAME_COLLISION);