From 03dfcce05aabf2ceecdb84528fc837176c52af77 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 27 Jun 2012 01:00:20 -0400 Subject: [PATCH] Windows: ensure TreeLock obtain and release same pointer The indirection ObjectInformation->ParentObjectInformation does not appear to be stable. When acquiring and releasing a parent TreeLock, use a local variable to store the ParentObjectInformation pointer and use that to access the TreeLock. This will ensure that the resource obtained is the one that is released. Change-Id: If359de0f7572cfa4e401baa47affa6872b79e932 Reviewed-on: http://gerrit.openafs.org/7651 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsrdr/kernel/lib/AFSCleanup.cpp | 155 ++++++++++-------- .../afsrdr/kernel/lib/AFSCommSupport.cpp | 29 ++-- src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp | 4 +- .../afsrdr/kernel/lib/AFSNameSupport.cpp | 12 +- 4 files changed, 115 insertions(+), 85 deletions(-) diff --git a/src/WINNT/afsrdr/kernel/lib/AFSCleanup.cpp b/src/WINNT/afsrdr/kernel/lib/AFSCleanup.cpp index 28d4ffc424..8c2eaf6191 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSCleanup.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSCleanup.cpp @@ -65,6 +65,7 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, AFSDeviceExt *pControlDeviceExt = NULL; IO_STATUS_BLOCK stIoSB; AFSObjectInfoCB *pObjectInfo = NULL; + AFSObjectInfoCB *pParentObjectInfo = NULL; AFSFileCleanupCB stFileCleanup; AFSFileCleanupResultCB *pResultCB = NULL; ULONG ulResultLen = 0; @@ -461,22 +462,24 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, SetFlag( pCcb->DirectoryCB->Flags, AFS_DIR_ENTRY_DELETED); - ASSERT( pObjectInfo->ParentObjectInformation != NULL); + pParentObjectInfo = pObjectInfo->ParentObjectInformation; - AFSAcquireExcl( pObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock, + ASSERT( pParentObjectInfo != NULL); + + AFSAcquireExcl( pParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock, TRUE); - if ( pObjectInfo->ParentObjectInformation->DataVersion.QuadPart != pResultCB->ParentDataVersion.QuadPart - 1) + if ( pParentObjectInfo->DataVersion.QuadPart != pResultCB->ParentDataVersion.QuadPart - 1) { - SetFlag( pObjectInfo->ParentObjectInformation->Flags, AFS_OBJECT_FLAGS_VERIFY); + SetFlag( pParentObjectInfo->Flags, AFS_OBJECT_FLAGS_VERIFY); - pObjectInfo->ParentObjectInformation->DataVersion.QuadPart = (ULONGLONG)-1; + pParentObjectInfo->DataVersion.QuadPart = (ULONGLONG)-1; } else { - pObjectInfo->ParentObjectInformation->DataVersion.QuadPart = pResultCB->ParentDataVersion.QuadPart; + pParentObjectInfo->DataVersion.QuadPart = pResultCB->ParentDataVersion.QuadPart; } // @@ -493,7 +496,7 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, pCcb->DirectoryCB, &pCcb->DirectoryCB->NameInformation.FileName); - AFSRemoveNameEntry( pObjectInfo->ParentObjectInformation, + AFSRemoveNameEntry( pParentObjectInfo, pCcb->DirectoryCB); } else @@ -506,9 +509,9 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, &pCcb->DirectoryCB->NameInformation.FileName); } - AFSReleaseResource( pObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock); + AFSReleaseResource( pParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock); - AFSFsRtlNotifyFullReportChange( pObjectInfo->ParentObjectInformation, + AFSFsRtlNotifyFullReportChange( pParentObjectInfo, pCcb, (ULONG)FILE_NOTIFY_CHANGE_FILE_NAME, (ULONG)FILE_ACTION_REMOVED); @@ -585,21 +588,23 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, if ( NT_SUCCESS( ntStatus)) { - if ( pObjectInfo->ParentObjectInformation != NULL) + pParentObjectInfo = pObjectInfo->ParentObjectInformation; + + if ( pParentObjectInfo != NULL) { - AFSAcquireExcl( pObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock, + AFSAcquireExcl( pParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock, TRUE); - if ( pObjectInfo->ParentObjectInformation->DataVersion.QuadPart != pResultCB->ParentDataVersion.QuadPart) + if ( pParentObjectInfo->DataVersion.QuadPart != pResultCB->ParentDataVersion.QuadPart) { - SetFlag( pObjectInfo->ParentObjectInformation->Flags, AFS_OBJECT_FLAGS_VERIFY); + SetFlag( pParentObjectInfo->Flags, AFS_OBJECT_FLAGS_VERIFY); - pObjectInfo->ParentObjectInformation->DataVersion.QuadPart = (ULONGLONG)-1; + pParentObjectInfo->DataVersion.QuadPart = (ULONGLONG)-1; } - AFSReleaseResource( pObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock); + AFSReleaseResource( pParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock); } } @@ -629,17 +634,19 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, // Decrement the open child handle count // - if( pObjectInfo->ParentObjectInformation != NULL) + pParentObjectInfo = pObjectInfo->ParentObjectInformation; + + if( pParentObjectInfo != NULL) { - ASSERT( pObjectInfo->ParentObjectInformation->Specific.Directory.ChildOpenHandleCount > 0); + ASSERT( pParentObjectInfo->Specific.Directory.ChildOpenHandleCount > 0); - lCount = InterlockedDecrement( &pObjectInfo->ParentObjectInformation->Specific.Directory.ChildOpenHandleCount); + lCount = InterlockedDecrement( &pParentObjectInfo->Specific.Directory.ChildOpenHandleCount); AFSDbgLogMsg( AFS_SUBSYSTEM_FCB_REF_COUNTING, AFS_TRACE_LEVEL_VERBOSE, "AFSCleanup (File) Decrement child open handle count on Parent object %08lX Cnt %d\n", - pObjectInfo->ParentObjectInformation, + pParentObjectInfo, lCount); } @@ -811,22 +818,24 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, SetFlag( pCcb->DirectoryCB->Flags, AFS_DIR_ENTRY_DELETED); - ASSERT( pObjectInfo->ParentObjectInformation != NULL); + pParentObjectInfo = pObjectInfo->ParentObjectInformation; - AFSAcquireExcl( pObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock, + ASSERT( pParentObjectInfo != NULL); + + AFSAcquireExcl( pParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock, TRUE); - if ( pObjectInfo->ParentObjectInformation->DataVersion.QuadPart != pResultCB->ParentDataVersion.QuadPart - 1) + if ( pParentObjectInfo->DataVersion.QuadPart != pResultCB->ParentDataVersion.QuadPart - 1) { - SetFlag( pObjectInfo->ParentObjectInformation->Flags, AFS_OBJECT_FLAGS_VERIFY); + SetFlag( pParentObjectInfo->Flags, AFS_OBJECT_FLAGS_VERIFY); - pObjectInfo->ParentObjectInformation->DataVersion.QuadPart = (ULONGLONG)-1; + pParentObjectInfo->DataVersion.QuadPart = (ULONGLONG)-1; } else { - pObjectInfo->ParentObjectInformation->DataVersion.QuadPart = pResultCB->ParentDataVersion.QuadPart; + pParentObjectInfo->DataVersion.QuadPart = pResultCB->ParentDataVersion.QuadPart; } // @@ -837,7 +846,7 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, if( !BooleanFlagOn( pCcb->DirectoryCB->Flags, AFS_DIR_ENTRY_NOT_IN_PARENT_TREE)) { - AFSRemoveNameEntry( pObjectInfo->ParentObjectInformation, + AFSRemoveNameEntry( pParentObjectInfo, pCcb->DirectoryCB); } else @@ -850,9 +859,9 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, &pCcb->DirectoryCB->NameInformation.FileName); } - AFSReleaseResource( pObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock); + AFSReleaseResource( pParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock); - AFSFsRtlNotifyFullReportChange( pObjectInfo->ParentObjectInformation, + AFSFsRtlNotifyFullReportChange( pParentObjectInfo, pCcb, (ULONG)FILE_NOTIFY_CHANGE_FILE_NAME, (ULONG)FILE_ACTION_REMOVED); @@ -875,12 +884,14 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, ClearFlag( pFcb->Flags, AFS_FCB_FLAG_FILE_MODIFIED); - if( pObjectInfo->ParentObjectInformation != NULL) + pParentObjectInfo = pObjectInfo->ParentObjectInformation; + + if( pParentObjectInfo != NULL) { ulNotifyFilter |= (FILE_NOTIFY_CHANGE_ATTRIBUTES); - AFSFsRtlNotifyFullReportChange( pObjectInfo->ParentObjectInformation, + AFSFsRtlNotifyFullReportChange( pParentObjectInfo, pCcb, (ULONG)ulNotifyFilter, (ULONG)FILE_ACTION_MODIFIED); @@ -906,21 +917,23 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, if ( NT_SUCCESS( ntStatus)) { - if ( pObjectInfo->ParentObjectInformation != NULL) + pParentObjectInfo = pObjectInfo->ParentObjectInformation; + + if ( pParentObjectInfo != NULL) { - AFSAcquireExcl( pObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock, + AFSAcquireExcl( pParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock, TRUE); - if ( pObjectInfo->ParentObjectInformation->DataVersion.QuadPart != pResultCB->ParentDataVersion.QuadPart) + if ( pParentObjectInfo->DataVersion.QuadPart != pResultCB->ParentDataVersion.QuadPart) { - SetFlag( pObjectInfo->ParentObjectInformation->Flags, AFS_OBJECT_FLAGS_VERIFY); + SetFlag( pParentObjectInfo->Flags, AFS_OBJECT_FLAGS_VERIFY); - pObjectInfo->ParentObjectInformation->DataVersion.QuadPart = (ULONGLONG)-1; + pParentObjectInfo->DataVersion.QuadPart = (ULONGLONG)-1; } - AFSReleaseResource( pObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock); + AFSReleaseResource( pParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock); } } @@ -958,17 +971,19 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, // Decrement the open child handle count // - if( pObjectInfo->ParentObjectInformation != NULL) + pParentObjectInfo = pObjectInfo->ParentObjectInformation; + + if( pParentObjectInfo != NULL) { - ASSERT( pObjectInfo->ParentObjectInformation->Specific.Directory.ChildOpenHandleCount > 0); + ASSERT( pParentObjectInfo->Specific.Directory.ChildOpenHandleCount > 0); - lCount = InterlockedDecrement( &pObjectInfo->ParentObjectInformation->Specific.Directory.ChildOpenHandleCount); + lCount = InterlockedDecrement( &pParentObjectInfo->Specific.Directory.ChildOpenHandleCount); AFSDbgLogMsg( AFS_SUBSYSTEM_FCB_REF_COUNTING, AFS_TRACE_LEVEL_VERBOSE, "AFSCleanup (Dir) Decrement child open handle count on Parent object %08lX Cnt %d\n", - pObjectInfo->ParentObjectInformation, + pParentObjectInfo, lCount); } @@ -1111,21 +1126,23 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, SetFlag( pCcb->DirectoryCB->Flags, AFS_DIR_ENTRY_DELETED); - ASSERT( pObjectInfo->ParentObjectInformation != NULL); + pParentObjectInfo = pObjectInfo->ParentObjectInformation; - AFSAcquireExcl( pObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock, + ASSERT( pParentObjectInfo != NULL); + + AFSAcquireExcl( pParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock, TRUE); - if ( pObjectInfo->ParentObjectInformation->DataVersion.QuadPart != pResultCB->ParentDataVersion.QuadPart - 1) + if ( pParentObjectInfo->DataVersion.QuadPart != pResultCB->ParentDataVersion.QuadPart - 1) { - SetFlag( pObjectInfo->ParentObjectInformation->Flags, AFS_OBJECT_FLAGS_VERIFY); + SetFlag( pParentObjectInfo->Flags, AFS_OBJECT_FLAGS_VERIFY); - pObjectInfo->ParentObjectInformation->DataVersion.QuadPart = (ULONGLONG)-1; + pParentObjectInfo->DataVersion.QuadPart = (ULONGLONG)-1; } else { - pObjectInfo->ParentObjectInformation->DataVersion.QuadPart = pResultCB->ParentDataVersion.QuadPart; + pParentObjectInfo->DataVersion.QuadPart = pResultCB->ParentDataVersion.QuadPart; } // @@ -1136,7 +1153,7 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, if( !BooleanFlagOn( pCcb->DirectoryCB->Flags, AFS_DIR_ENTRY_NOT_IN_PARENT_TREE)) { - AFSRemoveNameEntry( pObjectInfo->ParentObjectInformation, + AFSRemoveNameEntry( pParentObjectInfo, pCcb->DirectoryCB); } else @@ -1149,9 +1166,9 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, &pCcb->DirectoryCB->NameInformation.FileName); } - AFSReleaseResource( pObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock); + AFSReleaseResource( pParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock); - AFSFsRtlNotifyFullReportChange( pObjectInfo->ParentObjectInformation, + AFSFsRtlNotifyFullReportChange( pParentObjectInfo, pCcb, (ULONG)FILE_NOTIFY_CHANGE_FILE_NAME, (ULONG)FILE_ACTION_REMOVED); @@ -1174,12 +1191,14 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, ClearFlag( pFcb->Flags, AFS_FCB_FLAG_FILE_MODIFIED); - if( pObjectInfo->ParentObjectInformation != NULL) + pParentObjectInfo = pObjectInfo->ParentObjectInformation; + + if( pParentObjectInfo != NULL) { ulNotifyFilter |= (FILE_NOTIFY_CHANGE_ATTRIBUTES); - AFSFsRtlNotifyFullReportChange( pObjectInfo->ParentObjectInformation, + AFSFsRtlNotifyFullReportChange( pParentObjectInfo, pCcb, (ULONG)ulNotifyFilter, (ULONG)FILE_ACTION_MODIFIED); @@ -1205,21 +1224,23 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, if ( NT_SUCCESS( ntStatus)) { - if ( pObjectInfo->ParentObjectInformation != NULL) + pParentObjectInfo = pObjectInfo->ParentObjectInformation; + + if ( pParentObjectInfo != NULL) { - AFSAcquireExcl( pObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock, + AFSAcquireExcl( pParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock, TRUE); - if ( pObjectInfo->ParentObjectInformation->DataVersion.QuadPart != pResultCB->ParentDataVersion.QuadPart) + if ( pParentObjectInfo->DataVersion.QuadPart != pResultCB->ParentDataVersion.QuadPart) { - SetFlag( pObjectInfo->ParentObjectInformation->Flags, AFS_OBJECT_FLAGS_VERIFY); + SetFlag( pParentObjectInfo->Flags, AFS_OBJECT_FLAGS_VERIFY); - pObjectInfo->ParentObjectInformation->DataVersion.QuadPart = (ULONGLONG)-1; + pParentObjectInfo->DataVersion.QuadPart = (ULONGLONG)-1; } - AFSReleaseResource( pObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock); + AFSReleaseResource( pParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock); } } @@ -1249,17 +1270,19 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, // Decrement the open child handle count // - if( pObjectInfo->ParentObjectInformation != NULL) + pParentObjectInfo = pObjectInfo->ParentObjectInformation; + + if( pParentObjectInfo != NULL) { - ASSERT( pObjectInfo->ParentObjectInformation->Specific.Directory.ChildOpenHandleCount > 0); + ASSERT( pParentObjectInfo->Specific.Directory.ChildOpenHandleCount > 0); - lCount = InterlockedDecrement( &pObjectInfo->ParentObjectInformation->Specific.Directory.ChildOpenHandleCount); + lCount = InterlockedDecrement( &pParentObjectInfo->Specific.Directory.ChildOpenHandleCount); AFSDbgLogMsg( AFS_SUBSYSTEM_FCB_REF_COUNTING, AFS_TRACE_LEVEL_VERBOSE, "AFSCleanup (MP/SL) Decrement child open handle count on Parent object %08lX Cnt %d\n", - pObjectInfo->ParentObjectInformation, + pParentObjectInfo, lCount); } @@ -1294,16 +1317,18 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject, // Decrement the open child handle count // - if( pObjectInfo->ParentObjectInformation != NULL && - pObjectInfo->ParentObjectInformation->Specific.Directory.ChildOpenHandleCount > 0) + pParentObjectInfo = pObjectInfo->ParentObjectInformation; + + if( pParentObjectInfo != NULL && + pParentObjectInfo->Specific.Directory.ChildOpenHandleCount > 0) { - lCount = InterlockedDecrement( &pObjectInfo->ParentObjectInformation->Specific.Directory.ChildOpenHandleCount); + lCount = InterlockedDecrement( &pParentObjectInfo->Specific.Directory.ChildOpenHandleCount); AFSDbgLogMsg( AFS_SUBSYSTEM_FCB_REF_COUNTING, AFS_TRACE_LEVEL_VERBOSE, "AFSCleanup (Share) Decrement child open handle count on Parent object %08lX Cnt %d\n", - pObjectInfo->ParentObjectInformation, + pParentObjectInfo, lCount); } diff --git a/src/WINNT/afsrdr/kernel/lib/AFSCommSupport.cpp b/src/WINNT/afsrdr/kernel/lib/AFSCommSupport.cpp index 771041b0e7..3838185316 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSCommSupport.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSCommSupport.cpp @@ -2252,6 +2252,7 @@ AFSEvaluateTargetByID( IN AFSObjectInfoCB *ObjectInfo, AFSFileEvalResultCB *pEvalResultCB = NULL; AFSDirEnumEntry *pDirEnumCB = NULL; ULONG ulRequestFlags = AFS_REQUEST_FLAG_SYNCHRONOUS; + AFSObjectInfoCB *pParentInfo = NULL; __Enter { @@ -2259,10 +2260,12 @@ AFSEvaluateTargetByID( IN AFSObjectInfoCB *ObjectInfo, RtlZeroMemory( &stTargetID, sizeof( AFSEvalTargetCB)); - if( ObjectInfo->ParentObjectInformation != NULL) + pParentInfo = ObjectInfo->ParentObjectInformation; + + if( pParentInfo != NULL) { - stTargetID.ParentId = ObjectInfo->ParentObjectInformation->FileId; + stTargetID.ParentId = pParentInfo->FileId; } // @@ -2312,17 +2315,17 @@ AFSEvaluateTargetByID( IN AFSObjectInfoCB *ObjectInfo, if( ntStatus == STATUS_OBJECT_PATH_INVALID) { - if( ObjectInfo->ParentObjectInformation != NULL) + if( pParentInfo != NULL) { - AFSAcquireExcl( ObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock, + AFSAcquireExcl( pParentInfo->Specific.Directory.DirectoryNodeHdr.TreeLock, TRUE); - SetFlag( ObjectInfo->ParentObjectInformation->Flags, AFS_OBJECT_FLAGS_VERIFY); + SetFlag( pParentInfo->Flags, AFS_OBJECT_FLAGS_VERIFY); - ObjectInfo->ParentObjectInformation->DataVersion.QuadPart = (ULONGLONG)-1; + pParentInfo->DataVersion.QuadPart = (ULONGLONG)-1; - AFSReleaseResource( ObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock); + AFSReleaseResource( pParentInfo->Specific.Directory.DirectoryNodeHdr.TreeLock); } } @@ -2333,21 +2336,21 @@ AFSEvaluateTargetByID( IN AFSObjectInfoCB *ObjectInfo, // Validate the parent data version // - if ( ObjectInfo->ParentObjectInformation != NULL) + if ( pParentInfo != NULL) { - AFSAcquireExcl( ObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock, + AFSAcquireExcl( pParentInfo->Specific.Directory.DirectoryNodeHdr.TreeLock, TRUE); - if ( ObjectInfo->ParentObjectInformation->DataVersion.QuadPart != pEvalResultCB->ParentDataVersion.QuadPart) + if ( pParentInfo->DataVersion.QuadPart != pEvalResultCB->ParentDataVersion.QuadPart) { - SetFlag( ObjectInfo->ParentObjectInformation->Flags, AFS_OBJECT_FLAGS_VERIFY); + SetFlag( pParentInfo->Flags, AFS_OBJECT_FLAGS_VERIFY); - ObjectInfo->ParentObjectInformation->DataVersion.QuadPart = (ULONGLONG)-1; + pParentInfo->DataVersion.QuadPart = (ULONGLONG)-1; } - AFSReleaseResource( ObjectInfo->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock); + AFSReleaseResource( pParentInfo->Specific.Directory.DirectoryNodeHdr.TreeLock); } // diff --git a/src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp b/src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp index 4a53c502a7..5e6aa7dff2 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp @@ -2262,12 +2262,12 @@ AFSSetRenameInfo( IN PIRP Irp) if( pTargetParentObject != pSrcParentObject) { - AFSAcquireExcl( pSrcFcb->ObjectInformation->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock, + AFSAcquireExcl( pSrcParentObject->Specific.Directory.DirectoryNodeHdr.TreeLock, TRUE); bReleaseSourceDirLock = TRUE; - pSourceDirLock = pSrcFcb->ObjectInformation->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock; + pSourceDirLock = pSrcParentObject->Specific.Directory.DirectoryNodeHdr.TreeLock; } AFSLocateCaseSensitiveDirEntry( pTargetParentObject->Specific.Directory.DirectoryNodeHdr.CaseSensitiveTreeHead, diff --git a/src/WINNT/afsrdr/kernel/lib/AFSNameSupport.cpp b/src/WINNT/afsrdr/kernel/lib/AFSNameSupport.cpp index 43c06371ee..f13e3081bc 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSNameSupport.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSNameSupport.cpp @@ -1643,9 +1643,11 @@ AFSLocateNameEntry( IN GUID *AuthGroup, // on the entry // - ASSERT( pCurrentObject->ParentObjectInformation != NULL); + pParentObjectInfo = pCurrentObject->ParentObjectInformation; - AFSAcquireExcl( pCurrentObject->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock, + ASSERT( pParentObjectInfo != NULL); + + AFSAcquireExcl( pParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock, TRUE); AFSAcquireExcl( pCurrentObject->VolumeCB->ObjectInfoTree.TreeLock, @@ -1667,7 +1669,7 @@ AFSLocateNameEntry( IN GUID *AuthGroup, // Remove and delete the directory entry from the parent list // - AFSDeleteDirEntry( pCurrentObject->ParentObjectInformation, + AFSDeleteDirEntry( pParentObjectInfo, pDirEntry); if( pCurrentObject->ObjectReferenceCount <= 0) @@ -1699,11 +1701,11 @@ AFSLocateNameEntry( IN GUID *AuthGroup, SetFlag( pDirEntry->Flags, AFS_DIR_ENTRY_DELETED); - AFSRemoveNameEntry( pCurrentObject->ParentObjectInformation, + AFSRemoveNameEntry( pParentObjectInfo, pDirEntry); } - AFSReleaseResource( pCurrentObject->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock); + AFSReleaseResource( pParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock); AFSReleaseResource( pCurrentObject->VolumeCB->ObjectInfoTree.TreeLock);