[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--; pFcb->OpenHandleCount--;
DeviceExt->OpenHandleCount--; DeviceExt->OpenHandleCount--;
if (!(*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) && if (!vfatFCBIsDirectory(pFcb) &&
FsRtlAreThereCurrentFileLocks(&pFcb->FileLock)) FsRtlAreThereCurrentFileLocks(&pFcb->FileLock))
{ {
/* remove all locks this process have on this file */ /* remove all locks this process have on this file */
@ -83,6 +83,13 @@ VfatCleanupFile(
if (pFcb->Flags & FCB_DELETE_PENDING && if (pFcb->Flags & FCB_DELETE_PENDING &&
pFcb->OpenHandleCount == 0) pFcb->OpenHandleCount == 0)
{
if (vfatFCBIsDirectory(pFcb) &&
!VfatIsDirectoryEmpty(pFcb))
{
pFcb->Flags &= ~FCB_DELETE_PENDING;
}
else
{ {
PFILE_OBJECT tmpFileObject; PFILE_OBJECT tmpFileObject;
tmpFileObject = pFcb->FileObject; tmpFileObject = pFcb->FileObject;
@ -97,6 +104,7 @@ VfatCleanupFile(
pFcb->RFCB.FileSize.QuadPart = 0; pFcb->RFCB.FileSize.QuadPart = 0;
pFcb->RFCB.AllocationSize.QuadPart = 0; pFcb->RFCB.AllocationSize.QuadPart = 0;
} }
}
/* Uninitialize the cache (should be done even if caching was never initialized) */ /* Uninitialize the cache (should be done even if caching was never initialized) */
CcUninitializeCacheMap(FileObject, &pFcb->RFCB.FileSize, NULL); CcUninitializeCacheMap(FileObject, &pFcb->RFCB.FileSize, NULL);