Windows: AFSInitPIOCtlDirectoryCB Vol ObjInfoTree
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 4 Apr 2013 03:37:53 +0000 (23:37 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Sat, 6 Apr 2013 02:28:41 +0000 (19:28 -0700)
Hold the VolumeCB->ObjectInfoTree.TreeLock exclusively when calling
AFSAllocateObjectInfo() in order to protect the lists of child objects.

Change-Id: I16f104b8112e972fa8c60da2b0dbcb07ad42456c
Reviewed-on: http://gerrit.openafs.org/9723
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

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

index 2a86401..42ac41b 100644 (file)
@@ -5338,12 +5338,17 @@ AFSInitPIOCtlDirectoryCB( IN AFSObjectInfoCB *ParentObjectInfo)
     __Enter
     {
 
+        AFSAcquireExcl( ParentObjectInfo->VolumeCB->ObjectInfoTree.TreeLock,
+                        TRUE);
+
         pObjectInfoCB = AFSAllocateObjectInfo( ParentObjectInfo,
                                                0);
 
         if( pObjectInfoCB == NULL)
         {
 
+            AFSReleaseResource( ParentObjectInfo->VolumeCB->ObjectInfoTree.TreeLock);
+
             try_return( ntStatus = STATUS_INSUFFICIENT_RESOURCES);
         }
 
@@ -5356,6 +5361,8 @@ AFSInitPIOCtlDirectoryCB( IN AFSObjectInfoCB *ParentObjectInfo)
                       pObjectInfoCB,
                       lCount));
 
+        AFSReleaseResource( ParentObjectInfo->VolumeCB->ObjectInfoTree.TreeLock);
+
         pObjectInfoCB->FileType = (ULONG) AFS_FILE_TYPE_PIOCTL;
 
         pObjectInfoCB->FileAttributes = FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM;