Windows AFSRDR: Log before decrementing refcount
authorRod Widdowson <rdw@steadingsoftware.com>
Wed, 12 Oct 2011 10:04:33 +0000 (11:04 +0100)
committerJeffrey Altman <jaltman@openafs.org>
Wed, 12 Oct 2011 17:03:29 +0000 (10:03 -0700)
The library support package keeps count of the number of times
the library code is active.  When this goes to zero this means
that unload of the library can continue.

Although I cannot see it in the code it seems reasonable to assume
that at that stage the device object might go away so (and if it
doesn't do now it may in the future).  This potentially renders it
unsafe to do anything after InflightLibraryEvent has been signalled.

This patch moves the logging up to above the decrement of the refcount.

Change-Id: I9493d970cec4a025ca9e4c5542e2d838c87f7817
Reviewed-on: http://gerrit.openafs.org/5601
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

src/WINNT/afsrdr/kernel/fs/AFSLibrarySupport.cpp

index 23320ba..98ac0d4 100644 (file)
@@ -477,6 +477,11 @@ AFSClearLibraryRequest()
 
     __Enter
     {
+        AFSDbgLogMsg( AFS_SUBSYSTEM_LOAD_LIBRARY,
+                      AFS_TRACE_LEVEL_VERBOSE,
+                      "%s Inflight Count %08lX\n",
+                      __FUNCTION__,
+                      pDevExt->Specific.Control.InflightLibraryRequests);
 
         if( InterlockedDecrement( &pDevExt->Specific.Control.InflightLibraryRequests) == 0)
         {
@@ -486,11 +491,6 @@ AFSClearLibraryRequest()
                         FALSE);
         }
 
-        AFSDbgLogMsg( AFS_SUBSYSTEM_LOAD_LIBRARY,
-                      AFS_TRACE_LEVEL_VERBOSE,
-                      "%s Inflight Count %08lX\n",
-                      __FUNCTION__,
-                      pDevExt->Specific.Control.InflightLibraryRequests);
     }
 
     return ntStatus;