[FASTFAT]

- Do not delete files that have open handles
- Delete on cleanup instead of close, and do not depend on FileObject->DeletePending (since the last file object is not necessarily the one that caused the delete)
CORE-9433

svn path=/trunk/; revision=66931
This commit is contained in:
Thomas Faber 2015-03-28 16:58:53 +00:00
parent addfc9af92
commit 7f5f21a52f
2 changed files with 20 additions and 24 deletions

View file

@ -93,12 +93,31 @@ VfatCleanupFile(
ObDereferenceObject(tmpFileObject);
}
CcPurgeCacheSection(FileObject->SectionObjectPointer, NULL, 0, FALSE);
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) */
CcUninitializeCacheMap(FileObject, &pFcb->RFCB.FileSize, NULL);
if (pFcb->Flags & FCB_DELETE_PENDING &&
pFcb->OpenHandleCount == 0)
{
VfatDelEntry(DeviceExt, pFcb, NULL);
FsRtlNotifyFullReportChange(DeviceExt->NotifySync,
&(DeviceExt->NotifyList),
(PSTRING)&pFcb->PathNameU,
pFcb->PathNameU.Length - pFcb->LongNameU.Length,
NULL,
NULL,
((*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) ?
FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME),
FILE_ACTION_REMOVED,
NULL);
}
if (pFcb->OpenHandleCount != 0)
{
IoRemoveShareAccess(FileObject, &pFcb->FCBShareAccess);

View file

@ -46,29 +46,6 @@ VfatCloseFile(
}
else
{
if (FileObject->DeletePending)
{
if (pFcb->Flags & FCB_DELETE_PENDING)
{
VfatDelEntry(DeviceExt, pFcb, NULL);
FsRtlNotifyFullReportChange(DeviceExt->NotifySync,
&(DeviceExt->NotifyList),
(PSTRING)&pFcb->PathNameU,
pFcb->PathNameU.Length - pFcb->LongNameU.Length,
NULL,
NULL,
((*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) ?
FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME),
FILE_ACTION_REMOVED,
NULL);
}
else
{
Status = STATUS_DELETE_PENDING;
}
}
vfatReleaseFCB(DeviceExt, pFcb);
}