From: Jeffrey Altman Date: Tue, 27 Nov 2012 05:35:20 +0000 (-0500) Subject: Windows: PrimaryVolumeWorkerThread Garbage Collect Fcb X-Git-Tag: upstream/1.8.0_pre1^2~1759 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=a428033bfe78c00dad84af9c14645723344297cf;p=packages%2Fo%2Fopenafs.git Windows: PrimaryVolumeWorkerThread Garbage Collect Fcb Revert commit cecd99abd3837ef820d78fb15e450c8688b0f39b. Failing to garbage collect the FCB from the ObjectInformationCB at the earliest opportunity opens the door to a deadlock with Trend Micro's anti-virus driver. Trend Micro attempts to make a copy of the file data each time a CcPurgeCacheSection() is performed on the FCB. If during AFSValidateEntry or AFSVerifyEntry a DirectoryCB-> ObjectInformationCB->FCB is discovered which has a non-NULL SectionObjectPointers.DataSectionObject and the data version in the DirEnumEntryCB differs from the ObjectInformationCB, a CcPurgeCacheSection() call is performed while holding the FCB->NPFcb->Resource exclusively. Trend Micro will deadlock the thread making the CcPurgeCacheSection() call when it attempts to open the file in one of its worker threads. Change-Id: I912f22ab3695ad8faf1edcdbf2d50ff9a76277db Reviewed-on: http://gerrit.openafs.org/8529 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- diff --git a/src/WINNT/afsrdr/kernel/lib/AFSWorker.cpp b/src/WINNT/afsrdr/kernel/lib/AFSWorker.cpp index 639da470e..559fc6c7c 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSWorker.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSWorker.cpp @@ -1191,10 +1191,7 @@ AFSPrimaryVolumeWorkerThread( IN PVOID Context) AFSAcquireExcl( &pCurrentObject->NonPagedInfo->ObjectInfoLock, TRUE); - if ( pCurrentObject->ObjectReferenceCount <= 0 && - ( pCurrentObject->Fcb == NULL || - pCurrentObject->Fcb->OpenReferenceCount == 0 && - pCurrentObject->Fcb->Specific.File.ExtentCount == 0)) + if ( pCurrentObject->ObjectReferenceCount <= 0) { AFSRemoveFcb( &pCurrentObject->Fcb); @@ -1440,10 +1437,7 @@ AFSPrimaryVolumeWorkerThread( IN PVOID Context) AFSAcquireExcl( &pCurrentChildObject->NonPagedInfo->ObjectInfoLock, TRUE); - if( pCurrentChildObject->ObjectReferenceCount <= 0 && - ( pCurrentChildObject->Fcb == NULL || - pCurrentChildObject->Fcb->OpenReferenceCount == 0 && - pCurrentChildObject->Fcb->Specific.File.ExtentCount == 0)) + if( pCurrentChildObject->ObjectReferenceCount <= 0) { AFSRemoveFcb( &pCurrentChildObject->Fcb); @@ -1605,10 +1599,7 @@ AFSPrimaryVolumeWorkerThread( IN PVOID Context) TRUE); if( BooleanFlagOn( pCurrentObject->Flags, AFS_OBJECT_FLAGS_DELETED) && - pCurrentObject->ObjectReferenceCount <= 0 && - ( pCurrentObject->Fcb == NULL || - pCurrentObject->Fcb->OpenReferenceCount == 0 && - pCurrentObject->Fcb->Specific.File.ExtentCount == 0)) + pCurrentObject->ObjectReferenceCount <= 0) { AFSRemoveFcb( &pCurrentObject->Fcb);