Windows: avoid deadlock with Trend Micro

Trend Micro's anti-virus driver attempts to open the file in
response to CcPurgeCacheSection().  While processing
AFSSetDispositionInfo() the Fcb->NPFcb->Resource is held which is
also required if a status verification is required during the
CreateFile operation.  That results in a deadlock.

Avoid the deadlock by setting the PENDING_DELETE flag prior to
calling CcPurgeCacheSection().

Change-Id: I40d93d70e120525343afb917d473ad79a1f36e29
Reviewed-on: http://gerrit.openafs.org/6988
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
This commit is contained in:
Jeffrey Altman 2012-03-29 23:49:43 -04:00 committed by Jeffrey Altman
parent 6cb256375b
commit 134943a7a5

View File

@ -1994,6 +1994,14 @@ AFSSetDispositionInfo( IN PIRP Irp,
try_return( ntStatus = STATUS_DIRECTORY_NOT_EMPTY); try_return( ntStatus = STATUS_DIRECTORY_NOT_EMPTY);
} }
AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
AFS_TRACE_LEVEL_VERBOSE,
"AFSSetDispositionInfo Setting PENDING_DELETE on DirEntry %p Name %wZ\n",
DirectoryCB,
&DirectoryCB->NameInformation.FileName);
SetFlag( pCcb->DirectoryCB->Flags, AFS_DIR_ENTRY_PENDING_DELETE);
} }
else if( pFcb->Header.NodeTypeCode == AFS_FILE_FCB) else if( pFcb->Header.NodeTypeCode == AFS_FILE_FCB)
{ {
@ -2014,6 +2022,20 @@ AFSSetDispositionInfo( IN PIRP Irp,
try_return( ntStatus = STATUS_CANNOT_DELETE); try_return( ntStatus = STATUS_CANNOT_DELETE);
} }
//
// Set PENDING_DELETE before CcPurgeCacheSection to avoid a
// deadlock with Trend Micro's Enterprise anti-virus product
// which attempts to open the file which is being deleted.
//
AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
AFS_TRACE_LEVEL_VERBOSE,
"AFSSetDispositionInfo Setting PENDING_DELETE on DirEntry %p Name %wZ\n",
DirectoryCB,
&DirectoryCB->NameInformation.FileName);
SetFlag( pCcb->DirectoryCB->Flags, AFS_DIR_ENTRY_PENDING_DELETE);
// //
// Purge the cache as well // Purge the cache as well
// //
@ -2027,14 +2049,6 @@ AFSSetDispositionInfo( IN PIRP Irp,
TRUE); TRUE);
} }
} }
AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
AFS_TRACE_LEVEL_VERBOSE,
"AFSSetDispositionInfo Setting PENDING_DELETE on DirEntry %p Name %wZ\n",
DirectoryCB,
&DirectoryCB->NameInformation.FileName);
SetFlag( pCcb->DirectoryCB->Flags, AFS_DIR_ENTRY_PENDING_DELETE);
} }
else else
{ {