Windows: Missing lock in AFSNotifyRename
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 19 Nov 2012 20:33:33 +0000 (15:33 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Fri, 23 Nov 2012 22:18:15 +0000 (14:18 -0800)
If the ParentObjectInformation and TargetParentObjectInformation
are different, the TreeLock for each must be held.

Change-Id: Iac9910d838f8f35b286e4e40009cfd547ed8a438
Reviewed-on: http://gerrit.openafs.org/8479
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

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

index 5b60847..47d160f 100644 (file)
@@ -2168,6 +2168,9 @@ AFSNotifyRename( IN AFSObjectInfoCB *ObjectInfo,
         if ( ParentObjectInfo != TargetParentObjectInfo)
         {
 
+            AFSAcquireExcl( TargetParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock,
+                            TRUE);
+
             if ( TargetParentObjectInfo->DataVersion.QuadPart == pRenameResultCB->TargetParentDataVersion.QuadPart - 1)
             {
 
@@ -2243,6 +2246,12 @@ AFSNotifyRename( IN AFSObjectInfoCB *ObjectInfo,
             DirectoryCB->Type.Data.ShortNameTreeEntry.HashIndex = 0;
         }
 
+        if ( ParentObjectInfo != TargetParentObjectInfo)
+        {
+
+            AFSReleaseResource( TargetParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock);
+        }
+
         AFSReleaseResource( ParentObjectInfo->Specific.Directory.DirectoryNodeHdr.TreeLock);
 
         if( UpdatedFID != NULL)