Windows: Missing try..except in AFSCachedWrite
authorJeffrey Altman <jaltman@your-file-system.com>
Fri, 23 Aug 2013 19:00:17 +0000 (15:00 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Fri, 30 Aug 2013 19:10:35 +0000 (12:10 -0700)
Wrap another cache manager call with try..except

Change-Id: I2d10fc5a4c9a47f32590a394c57c412d773409f5
Reviewed-on: http://gerrit.openafs.org/10184
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp

index 8b3c404..0216d03 100644 (file)
@@ -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);
                 }
             }