https://git.reactos.org/?p=reactos.git;a=commitdiff;h=73fd52a164ac9f2cc5046…
commit 73fd52a164ac9f2cc50462295ec2f5eb23450a25
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Wed Feb 10 11:06:44 2021 +0100
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Wed Feb 10 11:14:19 2021 +0100
[NTOS:MM] Flush dirty pages after closing the page files.
CORE-17462
---
ntoskrnl/mm/shutdown.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/ntoskrnl/mm/shutdown.c b/ntoskrnl/mm/shutdown.c
index 89beca88fac..1d08a4f4166 100644
--- a/ntoskrnl/mm/shutdown.c
+++ b/ntoskrnl/mm/shutdown.c
@@ -24,8 +24,20 @@ MiShutdownSystem(VOID)
PFN_NUMBER Page;
BOOLEAN Dirty;
+ /* Loop through all the paging files */
+ for (i = 0; i < MmNumberOfPagingFiles; i++)
+ {
+ /* Free page file name */
+ ASSERT(MmPagingFile[i]->PageFileName.Buffer != NULL);
+ ExFreePoolWithTag(MmPagingFile[i]->PageFileName.Buffer, TAG_MM);
+ MmPagingFile[i]->PageFileName.Buffer = NULL;
+
+ /* And close them */
+ ZwClose(MmPagingFile[i]->FileHandle);
+ }
+
/* Loop through all the pages owned by the legacy Mm and page them out, if needed.
*/
- /* We do it twice, since flushing can cause the FS to dirtify new pages */
+ /* We do it as long as there are dirty pages, since flushing can cause the FS to
dirtify new ones. */
do
{
Dirty = FALSE;
@@ -59,20 +71,6 @@ MiShutdownSystem(VOID)
Page = MmGetLRUNextUserPage(Page, FALSE);
}
} while (Dirty);
-
- /* Loop through all the paging files */
- for (i = 0; i < MmNumberOfPagingFiles; i++)
- {
- /* Free page file name */
- ASSERT(MmPagingFile[i]->PageFileName.Buffer != NULL);
- ExFreePoolWithTag(MmPagingFile[i]->PageFileName.Buffer, TAG_MM);
- MmPagingFile[i]->PageFileName.Buffer = NULL;
-
- /* And close them */
- ZwClose(MmPagingFile[i]->FileHandle);
- }
-
- UNIMPLEMENTED;
}
VOID