[NTOS] Loop again and again until the whole cache is empty when sutting down

This commit is contained in:
Jérôme Gardou 2020-12-21 18:47:32 +01:00
parent addf824d87
commit 347a4f146b
2 changed files with 11 additions and 2 deletions

View File

@ -212,6 +212,7 @@ CcRosFlushDirtyPages (
BOOLEAN Locked;
NTSTATUS Status;
KIRQL OldIrql;
BOOLEAN FlushAll = (Target == MAXULONG);
DPRINT("CcRosFlushDirtyPages(Target %lu)\n", Target);
@ -226,8 +227,16 @@ CcRosFlushDirtyPages (
DPRINT("No Dirty pages\n");
}
while ((current_entry != &DirtyVacbListHead) && (Target > 0))
while (((current_entry != &DirtyVacbListHead) && (Target > 0)) || FlushAll)
{
if (current_entry == &DirtyVacbListHead)
{
ASSERT(FlushAll);
if (IsListEmpty(&DirtyVacbListHead))
break;
current_entry = DirtyVacbListHead.Flink;
}
current = CONTAINING_RECORD(current_entry,
ROS_VACB,
DirtyVacbListEntry);

View File

@ -1075,7 +1075,7 @@ NtSetSystemPowerState(IN POWER_ACTION SystemAction,
#ifndef NEWCC
/* Flush dirty cache pages */
/* XXX: Is that still mandatory? As now we'll wait on lazy writer to complete? */
CcRosFlushDirtyPages(-1, &Dummy, TRUE, FALSE); //HACK: We really should wait here!
CcRosFlushDirtyPages(MAXULONG, &Dummy, TRUE, FALSE); //HACK: We really should wait here!
#else
Dummy = 0;
#endif