Windows: FindObjectInfo refcnt under lock
[openafs.git] / src / WINNT / afsrdr / kernel / lib / AFSGeneric.cpp
index 3e85ec2..060b3bb 100644 (file)
@@ -6179,6 +6179,11 @@ AFSFindObjectInfo( IN AFSVolumeCB *VolumeCB,
     AFSObjectInfoCB *pObjectInfo = NULL;
     LONG             lCount;
 
+    ullIndex = AFSCreateLowIndex( FileId);
+
+    AFSAcquireShared( VolumeCB->ObjectInfoTree.TreeLock,
+                      TRUE);
+
     if ( AFSIsEqualFID( &VolumeCB->ObjectInformation.FileId, FileId))
     {
 
@@ -6187,16 +6192,9 @@ AFSFindObjectInfo( IN AFSVolumeCB *VolumeCB,
     else
     {
 
-        AFSAcquireExcl( VolumeCB->ObjectInfoTree.TreeLock,
-                        TRUE);
-
-        ullIndex = AFSCreateLowIndex( FileId);
-
         ntStatus = AFSLocateHashEntry( VolumeCB->ObjectInfoTree.TreeHead,
                                        ullIndex,
                                        (AFSBTreeEntry **)&pObjectInfo);
-
-        AFSReleaseResource( VolumeCB->ObjectInfoTree.TreeLock);
     }
 
     if ( NT_SUCCESS( ntStatus)) {
@@ -6211,6 +6209,8 @@ AFSFindObjectInfo( IN AFSVolumeCB *VolumeCB,
                       lCount));
     }
 
+    AFSReleaseResource( VolumeCB->ObjectInfoTree.TreeLock);
+
     return pObjectInfo;
 }