git: e302ae7756c8 - stable/13 - vm_page: Tighten the object lock assertion in vm_page_invalid()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 13 Dec 2021 13:28:47 UTC
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=e302ae7756c87fe20f04578c8d2e126c17a9fa1a

commit e302ae7756c87fe20f04578c8d2e126c17a9fa1a
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-12-05 15:39:58 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-12-13 13:26:34 +0000

    vm_page: Tighten the object lock assertion in vm_page_invalid()
    
    A page must not become invalid while vm_fault_soft_fast() is attempting
    to map unbusied pages for reading.
    
    Note that all callers hold the object write lock already, and
    vm_page_set_invalid() asserts the object write lock.
    
    Reviewed by:    kib
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 39a7396f5d0c3eac4401229e1b24fb8b89efc862)
---
 sys/vm/vm_page.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 74c03ed3a21b..6cdde80bdb8b 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -5288,7 +5288,7 @@ vm_page_invalid(vm_page_t m)
 {
 
 	vm_page_assert_busied(m);
-	VM_OBJECT_ASSERT_LOCKED(m->object);
+	VM_OBJECT_ASSERT_WLOCKED(m->object);
 	MPASS(!pmap_page_is_mapped(m));
 
 	if (vm_page_xbusied(m))