[FASTFAT]

- Cancel deletion of a directory if it is not empty when its last handle is closed
CORE-6931

svn path=/trunk/; revision=72195
This commit is contained in:
Thomas Faber 2016-08-11 11:41:25 +00:00
parent d2ae65c710
commit 3b70374248

View file

@ -66,7 +66,7 @@ VfatCleanupFile(
pFcb->OpenHandleCount--;
DeviceExt->OpenHandleCount--;
if (!(*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) &&
if (!vfatFCBIsDirectory(pFcb) &&
FsRtlAreThereCurrentFileLocks(&pFcb->FileLock))
{
/* remove all locks this process have on this file */
@ -84,18 +84,26 @@ VfatCleanupFile(
if (pFcb->Flags & FCB_DELETE_PENDING &&
pFcb->OpenHandleCount == 0)
{
PFILE_OBJECT tmpFileObject;
tmpFileObject = pFcb->FileObject;
if (tmpFileObject != NULL)
if (vfatFCBIsDirectory(pFcb) &&
!VfatIsDirectoryEmpty(pFcb))
{
pFcb->FileObject = NULL;
CcUninitializeCacheMap(tmpFileObject, NULL, NULL);
ObDereferenceObject(tmpFileObject);
pFcb->Flags &= ~FCB_DELETE_PENDING;
}
else
{
PFILE_OBJECT tmpFileObject;
tmpFileObject = pFcb->FileObject;
if (tmpFileObject != NULL)
{
pFcb->FileObject = NULL;
CcUninitializeCacheMap(tmpFileObject, NULL, NULL);
ObDereferenceObject(tmpFileObject);
}
pFcb->RFCB.ValidDataLength.QuadPart = 0;
pFcb->RFCB.FileSize.QuadPart = 0;
pFcb->RFCB.AllocationSize.QuadPart = 0;
pFcb->RFCB.ValidDataLength.QuadPart = 0;
pFcb->RFCB.FileSize.QuadPart = 0;
pFcb->RFCB.AllocationSize.QuadPart = 0;
}
}
/* Uninitialize the cache (should be done even if caching was never initialized) */