From: Jeffrey Altman Date: Mon, 18 Jun 2012 14:10:32 +0000 (-0400) Subject: Windows: Do not permit RDR worker threads to quit X-Git-Tag: upstream/1.8.0_pre1^2~2289 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=e513799232f72ce9deabe5097f06f42d4ce09bf2;p=packages%2Fo%2Fopenafs.git Windows: Do not permit RDR worker threads to quit If the DeviceIoControl from the service's redirector worker threads fails the thread will terminate. This is a problem because if all of the threads quit the afs redirector will end up deadlocking all requests since there will be no method of delivering them to the service. If there is an error log it (if possible), and retry. Hopefully it will be transient. Change-Id: I3ce5e338e41fd71c5289fe778789f0300c0b5ecd Reviewed-on: http://gerrit.openafs.org/7627 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- diff --git a/src/WINNT/afsrdr/user/RDRInit.cpp b/src/WINNT/afsrdr/user/RDRInit.cpp index c8310a9af..0b624963f 100644 --- a/src/WINNT/afsrdr/user/RDRInit.cpp +++ b/src/WINNT/afsrdr/user/RDRInit.cpp @@ -471,7 +471,7 @@ RDR_RequestWorkerThread( LPVOID lpParameter) requestBuffer->RequestFlags = pInfo->Flags; - if( !RDR_DeviceIoControl( hDevHandle, + if( RDR_DeviceIoControl( hDevHandle, IOCTL_AFS_PROCESS_IRP_REQUEST, (void *)requestBuffer, sizeof( AFSCommRequest), @@ -480,21 +480,27 @@ RDR_RequestWorkerThread( LPVOID lpParameter) &bytesReturned )) { + WaitForSingleObject( RDR_SuspendEvent, INFINITE); + // - // Error condition back from driver + // Go process the request // - break; + if (!Exit) + RDR_ProcessRequest( requestBuffer); } + else + { - WaitForSingleObject( RDR_SuspendEvent, INFINITE); - - // - // Go process the request - // + if (afsd_logp->enabled) { + WCHAR wchBuffer[256]; + DWORD gle = GetLastError(); - if (!Exit) - RDR_ProcessRequest( requestBuffer); + swprintf( wchBuffer, + L"Failed to post IOCTL_AFS_IRP_REQUEST gle 0x%x", gle); + osi_Log1(afsd_logp, "%S", osi_LogSaveStringW(afsd_logp, wchBuffer)); + } + } } free( requestBuffer);