diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c index 3952986dc44..35d0df31545 100644 --- a/ntoskrnl/cc/view.c +++ b/ntoskrnl/cc/view.c @@ -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); diff --git a/ntoskrnl/po/power.c b/ntoskrnl/po/power.c index 7d2f4d7114a..6dee7054c02 100644 --- a/ntoskrnl/po/power.c +++ b/ntoskrnl/po/power.c @@ -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