From 8b76a59a0d7cc41928cd0519032c9f8e3cf7656c Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 18 Mar 2008 02:39:04 +0000 Subject: [PATCH] Fixed race condition in the page writer: The state of the page we have picked might have changed while we were locking its cache. Might fix #1931. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24430 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/vm/vm_page.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/system/kernel/vm/vm_page.cpp b/src/system/kernel/vm/vm_page.cpp index 4539f83869..367bd634c5 100644 --- a/src/system/kernel/vm/vm_page.cpp +++ b/src/system/kernel/vm/vm_page.cpp @@ -965,6 +965,11 @@ page_writer(void* /*unused*/) } InterruptsSpinLocker locker(sPageLock); + + // state might have change while we were locking the cache + if (page->state != PAGE_STATE_MODIFIED) + continue; + remove_page_from_queue(&sModifiedPageQueue, page); page->state = PAGE_STATE_BUSY; page->busy_writing = true;