From 48e1c8593f97b278ce02a78cd3002368ee92d907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Thu, 21 Jan 2021 16:39:27 +0100 Subject: [PATCH] [NTOS:PO] Flush dirty pages after flushing volumes --- ntoskrnl/po/power.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ntoskrnl/po/power.c b/ntoskrnl/po/power.c index 6dee7054c02..125edbc11df 100644 --- a/ntoskrnl/po/power.c +++ b/ntoskrnl/po/power.c @@ -1072,18 +1072,19 @@ NtSetSystemPowerState(IN POWER_ACTION SystemAction, /* Check if we're still in an invalid status */ if (!NT_SUCCESS(Status)) break; + /* Flush all volumes and the registry */ + DPRINT("Flushing volumes\n"); + PopFlushVolumes(PopAction.Shutdown); + #ifndef NEWCC /* Flush dirty cache pages */ /* XXX: Is that still mandatory? As now we'll wait on lazy writer to complete? */ - CcRosFlushDirtyPages(MAXULONG, &Dummy, TRUE, FALSE); //HACK: We really should wait here! + CcRosFlushDirtyPages(MAXULONG, &Dummy, TRUE, FALSE); + DPRINT("Cache flushed %lu pages\n", Dummy); #else Dummy = 0; #endif - /* Flush all volumes and the registry */ - DPRINT("Flushing volumes, cache flushed %lu pages\n", Dummy); - PopFlushVolumes(PopAction.Shutdown); - /* Set IRP for drivers */ PopAction.IrpMinor = IRP_MN_SET_POWER; if (PopAction.Shutdown)