Windows: Failed to release correct lock
authorPeter Scott <pscott@kerneldrivers.com>
Fri, 4 Nov 2011 13:31:57 +0000 (07:31 -0600)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 4 Nov 2011 22:38:12 +0000 (15:38 -0700)
For cross-directory renames, the correct parent lock was not being tracked

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

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

index 390ad80..cdd850f 100644 (file)
@@ -1917,6 +1917,7 @@ AFSSetRenameInfo( IN PIRP Irp)
     BOOLEAN bReleaseVolumeLock = FALSE;
     BOOLEAN bReleaseTargetDirLock = FALSE;
     BOOLEAN bReleaseSourceDirLock = FALSE;
+    PERESOURCE  pSourceDirLock = NULL;
 
     __Enter
     {
@@ -2036,10 +2037,6 @@ AFSSetRenameInfo( IN PIRP Irp)
             try_return( ntStatus = STATUS_NOT_SAME_DEVICE);
         }
 
-        //
-        // If the target exists be sure the ReplaceIfExists flag is set
-        //
-
         AFSAcquireExcl( pTargetParentObject->VolumeCB->VolumeLock,
                         TRUE);
 
@@ -2059,6 +2056,8 @@ AFSSetRenameInfo( IN PIRP Irp)
                             TRUE);
 
             bReleaseSourceDirLock = TRUE;
+
+            pSourceDirLock = pSrcFcb->ObjectInformation->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock;
         }
 
         AFSLocateCaseSensitiveDirEntry( pTargetParentObject->Specific.Directory.DirectoryNodeHdr.CaseSensitiveTreeHead,
@@ -2517,7 +2516,7 @@ try_exit:
 
         if( bReleaseSourceDirLock)
         {
-            AFSReleaseResource( pSrcFcb->ObjectInformation->ParentObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock);
+            AFSReleaseResource( pSourceDirLock);
         }
     }