From d142082caed1eba870ffee017193883a0508306e Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 16 Dec 2011 17:24:36 -0500 Subject: [PATCH] Windows: return error to system paging requests If an error has been set on a file, return that error to the System process for any outstanding extent requests. Change-Id: I8f7244f19cc0e3f96a1599ce011251ade0afe3f4 Reviewed-on: http://gerrit.openafs.org/6360 Reviewed-by: Jeffrey Altman Tested-by: BuildBot --- .../afsrdr/kernel/lib/AFSExtentsSupport.cpp | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/WINNT/afsrdr/kernel/lib/AFSExtentsSupport.cpp b/src/WINNT/afsrdr/kernel/lib/AFSExtentsSupport.cpp index bed25ad80..66300ed5a 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSExtentsSupport.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSExtentsSupport.cpp @@ -682,6 +682,7 @@ AFSRequestExtents( IN AFSFcb *Fcb, LARGE_INTEGER liAlignedOffset; ULONG ulAlignedLength = 0; LARGE_INTEGER liTimeOut; + ULONGLONG ullProcessId = (ULONGLONG)PsGetCurrentProcessId(); // // Check our extents, then fire off a request if we need to. @@ -717,10 +718,11 @@ AFSRequestExtents( IN AFSFcb *Fcb, { // - // If this isn't the same process which caused the failure then try to request them again + // If this isn't the same process which caused the failure + // then try to request them again // - if( Fcb->Specific.File.ExtentRequestProcessId == (ULONGLONG)PsGetCurrentProcessId()) + if( Fcb->Specific.File.ExtentRequestProcessId == ullProcessId) { ntStatus = pNPFcb->Specific.File.ExtentsRequestStatus; @@ -764,7 +766,7 @@ AFSRequestExtents( IN AFSFcb *Fcb, // If this isn't the same process which caused the failure then try to request them again // - if( Fcb->Specific.File.ExtentRequestProcessId == (ULONGLONG)PsGetCurrentProcessId()) + if( Fcb->Specific.File.ExtentRequestProcessId == ullProcessId) { ntStatus = pNPFcb->Specific.File.ExtentsRequestStatus; @@ -792,10 +794,11 @@ AFSRequestExtents( IN AFSFcb *Fcb, { // - // If this isn't the same process which caused the failure then try to request them again + // If this isn't the same process which caused the failure + // then try to request them again // - if( Fcb->Specific.File.ExtentRequestProcessId == (ULONGLONG)PsGetCurrentProcessId()) + if( Fcb->Specific.File.ExtentRequestProcessId == ullProcessId) { AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING, AFS_TRACE_LEVEL_VERBOSE, @@ -955,6 +958,7 @@ AFSRequestExtentsAsync( IN AFSFcb *Fcb, LARGE_INTEGER liAlignedOffset; ULONG ulAlignedLength = 0; BOOLEAN bRegionMapped = FALSE; + ULONGLONG ullProcessId = (ULONGLONG)PsGetCurrentProcessId(); __Enter { @@ -973,7 +977,7 @@ AFSRequestExtentsAsync( IN AFSFcb *Fcb, // If this isn't the same process which caused the failure then try to request them again // - if( Fcb->Specific.File.ExtentRequestProcessId == (ULONGLONG)PsGetCurrentProcessId()) + if( Fcb->Specific.File.ExtentRequestProcessId == ullProcessId) { try_return( ntStatus = pNPFcb->Specific.File.ExtentsRequestStatus); } @@ -2660,6 +2664,7 @@ AFSWaitForExtentMapping( AFSFcb *Fcb ) { NTSTATUS ntStatus = STATUS_SUCCESS; LARGE_INTEGER liTimeOut; + ULONGLONG ullProcessId = (ULONGLONG)PsGetCurrentProcessId(); __Enter { @@ -2673,7 +2678,7 @@ AFSWaitForExtentMapping( AFSFcb *Fcb ) // If this isn't the same process which caused the failure then try to request them again // - if( Fcb->Specific.File.ExtentRequestProcessId == (ULONGLONG)PsGetCurrentProcessId()) + if( Fcb->Specific.File.ExtentRequestProcessId == ullProcessId) { try_return( ntStatus = Fcb->NPFcb->Specific.File.ExtentsRequestStatus); } @@ -2693,10 +2698,12 @@ AFSWaitForExtentMapping( AFSFcb *Fcb ) { // - // If this isn't the same process which caused the failure then try to request them again + // If this isn't the same process which caused the failure + // and this isn't the System process, then try to request them again // - if( Fcb->Specific.File.ExtentRequestProcessId == (ULONGLONG)PsGetCurrentProcessId()) + if( Fcb->Specific.File.ExtentRequestProcessId == ullProcessId || + ullProcessId == 0x4) { try_return( ntStatus = Fcb->NPFcb->Specific.File.ExtentsRequestStatus); } -- 2.39.5