sys: FspVolumeDelete: perform MmForceSectionClosed on open files

- this removes them from the Mm Standby List
This commit is contained in:
Bill Zissimopoulos 2016-11-02 18:27:38 -07:00
parent b56379b542
commit c665812d76
3 changed files with 28 additions and 5 deletions

View File

@ -590,7 +590,9 @@ NTSTATUS FspFsvolDeviceCopyContextByNameList(PDEVICE_OBJECT DeviceObject,
*PContextCount = 0;
ContextCount = RtlNumberGenericTableElementsAvl(&FsvolDeviceExtension->ContextByNameTable);
Contexts = FspAlloc(sizeof(PVOID) * ContextCount);
/* if ContextCount == 0 allocate an empty Context list */
Contexts = FspAlloc(sizeof(PVOID) * (0 != ContextCount ? ContextCount : 1));
if (0 == Contexts)
return STATUS_INSUFFICIENT_RESOURCES;

View File

@ -282,9 +282,30 @@ VOID FspVolumeDelete(
{
// !PAGED_CODE();
PDEVICE_OBJECT FsvolDeviceObject = IrpSp->FileObject->FsContext2;
FSP_FILE_NODE **FileNodes;
ULONG FileNodeCount, Index;
NTSTATUS Result;
FspDeviceReference(FsvolDeviceObject);
FspDeviceGlobalLock();
FspVolumeDeleteNoLock(FsctlDeviceObject, Irp, IrpSp);
FspDeviceGlobalUnlock();
/*
* Call MmForceSectionClosed on open files to ensure that Mm removes them from Standby List.
*/
Result = FspFileNodeCopyList(FsvolDeviceObject, &FileNodes, &FileNodeCount);
if (NT_SUCCESS(Result))
{
for (Index = FileNodeCount - 1; FileNodeCount > Index; Index--)
MmForceSectionClosed(&FileNodes[Index]->NonPaged->SectionObjectPointers, TRUE);
FspFileNodeDeleteList(FileNodes, FileNodeCount);
}
FspDeviceDereference(FsvolDeviceObject);
}
static VOID FspVolumeDeleteNoLock(

View File

@ -171,13 +171,13 @@ exit /b 0
:standby-memfs-x64-disk
M:
copy "%ProjRoot%\build\VStudio\build\%Configuration%\winfsp-tests-x64.exe"
copy "%ProjRoot%\build\VStudio\build\%Configuration%\*"
if !ERRORLEVEL! neq 0 goto fail
exit /b 0
:standby-memfs-x64-net
N:
copy "%ProjRoot%\build\VStudio\build\%Configuration%\winfsp-tests-x64.exe"
copy "%ProjRoot%\build\VStudio\build\%Configuration%\*"
if !ERRORLEVEL! neq 0 goto fail
exit /b 0
@ -206,13 +206,13 @@ exit /b 0
:standby-memfs-x86-disk
O:
copy "%ProjRoot%\build\VStudio\build\%Configuration%\winfsp-tests-x86.exe"
copy "%ProjRoot%\build\VStudio\build\%Configuration%\*"
if !ERRORLEVEL! neq 0 goto fail
exit /b 0
:standby-memfs-x86-net
P:
copy "%ProjRoot%\build\VStudio\build\%Configuration%\winfsp-tests-x86.exe"
copy "%ProjRoot%\build\VStudio\build\%Configuration%\*"
if !ERRORLEVEL! neq 0 goto fail
exit /b 0