From: Jeffrey Altman Date: Fri, 23 Aug 2013 19:00:17 +0000 (-0400) Subject: Windows: Missing try..except in AFSCachedWrite X-Git-Tag: upstream/1.8.0_pre1^2~1030 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=3f797fc71174a5779cf1cae3ba452f401a668881;p=packages%2Fo%2Fopenafs.git Windows: Missing try..except in AFSCachedWrite Wrap another cache manager call with try..except Change-Id: I2d10fc5a4c9a47f32590a394c57c412d773409f5 Reviewed-on: http://gerrit.openafs.org/10184 Tested-by: BuildBot Reviewed-by: Jeffrey Altman --- diff --git a/src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp b/src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp index 8b3c40418..0216d03a9 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp @@ -1925,31 +1925,49 @@ AFSCachedWrite( IN PDEVICE_OBJECT DeviceObject, BooleanFlagOn(pFileObject->Flags, (FO_NO_INTERMEDIATE_BUFFERING + FO_WRITE_THROUGH))) { - // - // We have detected a file we do a write through with. - // - - CcFlushCache(&pFcb->NPFcb->SectionObjectPointers, - &liCurrentOffset, - ulCurrentIO, - &iosbFlush); - - if( !NT_SUCCESS( iosbFlush.Status)) + __try + { + // + // We have detected a file we do a write through with. + // + + CcFlushCache(&pFcb->NPFcb->SectionObjectPointers, + &liCurrentOffset, + ulCurrentIO, + &iosbFlush); + + if( !NT_SUCCESS( iosbFlush.Status)) + { + + AFSDbgTrace(( AFS_SUBSYSTEM_IO_PROCESSING, + AFS_TRACE_LEVEL_ERROR, + "AFSCachedWrite (%p) CcFlushCache failure %wZ FID %08lX-%08lX-%08lX-%08lX Status 0x%08lX Bytes 0x%08lX\n", + Irp, + &pFileObject->FileName, + pFcb->ObjectInformation->FileId.Cell, + pFcb->ObjectInformation->FileId.Volume, + pFcb->ObjectInformation->FileId.Vnode, + pFcb->ObjectInformation->FileId.Unique, + iosbFlush.Status, + iosbFlush.Information)); + + try_return( ntStatus = iosbFlush.Status); + } + } + __except( AFSExceptionFilter( __FUNCTION__, GetExceptionCode(), GetExceptionInformation())) { + ntStatus = GetExceptionCode(); + AFSDbgTrace(( AFS_SUBSYSTEM_IO_PROCESSING, AFS_TRACE_LEVEL_ERROR, - "AFSCachedWrite (%p) CcFlushCache failure %wZ FID %08lX-%08lX-%08lX-%08lX Status 0x%08lX Bytes 0x%08lX\n", + "AFSCachedWrite (%p) CcFlushCache Threw exception %wZ @ %0I64X Status %08lX\n", Irp, &pFileObject->FileName, - pFcb->ObjectInformation->FileId.Cell, - pFcb->ObjectInformation->FileId.Volume, - pFcb->ObjectInformation->FileId.Vnode, - pFcb->ObjectInformation->FileId.Unique, - iosbFlush.Status, - iosbFlush.Information)); - - try_return( ntStatus = iosbFlush.Status); + liCurrentOffset.QuadPart, + ntStatus)); + + try_return( ntStatus); } }