From 3f797fc71174a5779cf1cae3ba452f401a668881 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 23 Aug 2013 15:00:17 -0400 Subject: [PATCH] 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 --- src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp | 56 ++++++++++++++++-------- 1 file changed, 37 insertions(+), 19 deletions(-) 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); } } -- 2.39.5