]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Windows: only flush buffers on shutdown if running
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 27 Oct 2011 21:57:25 +0000 (17:57 -0400)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 27 Oct 2011 22:57:23 +0000 (15:57 -0700)
If a service shutdown message is received prior to the
service entering the running state, do not attempt to
buf_CleanAndReset() because the required data structures
and locks are not initialized.

Change-Id: I29f20dbe91230f078334ca58e8791d2422cdecfd
Reviewed-on: http://gerrit.openafs.org/5733
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
src/WINNT/afsd/afsd_service.c

index 532f9567d94fa5077b62f4068bfabef6e51b5597..7118a905c1f0ee1d8a21f9a6a3ec304b62446b45 100644 (file)
@@ -249,6 +249,7 @@ afsd_ServiceControlHandlerEx(
     long code;
     DWORD dwRet = ERROR_CALL_NOT_IMPLEMENTED;
     OSVERSIONINFO osVersion;
+    DWORD dwCurrentState = ServiceStatus.dwCurrentState;
 
     /* Get the version of Windows */
     memset(&osVersion, 0x00, sizeof(osVersion));
@@ -272,7 +273,8 @@ afsd_ServiceControlHandlerEx(
         SetServiceStatus(StatusHandle, &ServiceStatus);
 
         /* Write all dirty buffers back to server */
-       if ( !lana_OnlyLoopback() )
+       if (dwCurrentState == SERVICE_RUNNING &&
+            !lana_OnlyLoopback() )
            buf_CleanAndReset();
 
         /* Force trace if requested */