Windows: Do not open file if shutdown in progress
authorJeffrey Altman <jaltman@your-file-system.com>
Fri, 3 Feb 2012 16:14:50 +0000 (11:14 -0500)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 3 Feb 2012 21:36:08 +0000 (13:36 -0800)
Perform the shutdown check earlier in AFSCommonCreate() to prevent
a request from being processed after the service indicates that
a shutdown has begun.

Change-Id: I8959141b5e2161ffe960e93a500b1153d9594a28
Reviewed-on: http://gerrit.openafs.org/6647
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

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

index 08fecc1..c9b14ba 100644 (file)
@@ -187,6 +187,21 @@ AFSCommonCreate( IN PDEVICE_OBJECT DeviceObject,
                                  (ULONGLONG)PsGetCurrentThreadId(),
                                   &stAuthGroup);
 
+        //
+        // If we are in shutdown mode then fail the request
+        //
+
+        if( BooleanFlagOn( pDeviceExt->DeviceFlags, AFS_DEVICE_FLAG_REDIRECTOR_SHUTDOWN))
+        {
+
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                          AFS_TRACE_LEVEL_WARNING,
+                          "AFSCommonCreate (%08lX) Open request after shutdown\n",
+                          Irp);
+
+            try_return( ntStatus = STATUS_TOO_LATE);
+        }
+
         if( !BooleanFlagOn( AFSGlobalRoot->ObjectInformation.Flags, AFS_OBJECT_FLAGS_DIRECTORY_ENUMERATED))
         {
 
@@ -205,21 +220,6 @@ AFSCommonCreate( IN PDEVICE_OBJECT DeviceObject,
         }
 
         //
-        // If we are in shutdown mode then fail the request
-        //
-
-        if( BooleanFlagOn( pDeviceExt->DeviceFlags, AFS_DEVICE_FLAG_REDIRECTOR_SHUTDOWN))
-        {
-
-            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
-                          AFS_TRACE_LEVEL_WARNING,
-                          "AFSCommonCreate (%08lX) Open request after shutdown\n",
-                          Irp);
-
-            try_return( ntStatus = STATUS_TOO_LATE);
-        }
-
-        //
         // Go and parse the name for processing.
         // If ulParseFlags is returned with AFS_PARSE_FLAG_FREE_FILE_BUFFER set,
         // then we are responsible for releasing the uniRootFileName.Buffer.