From: Jeffrey Altman Date: Fri, 25 Jan 2013 00:25:37 +0000 (-0500) Subject: Windows: AFSProcessCreate drop DirOpenRefCount on exit X-Git-Tag: upstream/1.8.0_pre1^2~1602 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=391bdbf9ace271ef41d6c73031d172cdad802f79;p=packages%2Fo%2Fopenafs.git Windows: AFSProcessCreate drop DirOpenRefCount on exit AFSProcessCreate() must not maintain its DirOpenReferenceCount when bFileCreated is true because the AFSCcb maintains its own count and the one obtained by AFSProcessCreate() will only be leaked. Change-Id: I6591eb1c10d3dffe7449894b29c9999f5db91d64 Reviewed-on: http://gerrit.openafs.org/8961 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- diff --git a/src/WINNT/afsrdr/kernel/lib/AFSCreate.cpp b/src/WINNT/afsrdr/kernel/lib/AFSCreate.cpp index 68f770f41..1ec51b73d 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSCreate.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSCreate.cpp @@ -2051,6 +2051,26 @@ try_exit: AFSReleaseResource( &(*Fcb)->NPFcb->Resource); } + if ( bFileCreated) + { + + // + // Decrement the reference added during initialization of the DE + // AFSInitCcb allocates its own reference count. + // + + lCount = InterlockedDecrement( &pDirEntry->DirOpenReferenceCount); + + AFSDbgLogMsg( AFS_SUBSYSTEM_DIRENTRY_REF_COUNTING, + AFS_TRACE_LEVEL_VERBOSE, + "AFSProcessCreate Decrement count on %wZ DE %p Cnt %d\n", + &pDirEntry->NameInformation.FileName, + pDirEntry, + lCount); + + ASSERT( lCount >= 0); + } + if( !NT_SUCCESS( ntStatus)) { @@ -2077,21 +2097,6 @@ try_exit: AuthGroup, FALSE); - // - // Decrement the reference added during initialization of the DE - // - - lCount = InterlockedDecrement( &pDirEntry->DirOpenReferenceCount); - - AFSDbgLogMsg( AFS_SUBSYSTEM_DIRENTRY_REF_COUNTING, - AFS_TRACE_LEVEL_VERBOSE, - "AFSProcessCreate Decrement count on %wZ DE %p Cnt %d\n", - &pDirEntry->NameInformation.FileName, - pDirEntry, - lCount); - - ASSERT( lCount >= 0); - // // Pull the directory entry from the parent //