Do not clean PG_BUSY before calling uvm_anon_release().
authormpi <mpi@openbsd.org>
Tue, 28 Jun 2022 10:45:55 +0000 (10:45 +0000)
committermpi <mpi@openbsd.org>
Tue, 28 Jun 2022 10:45:55 +0000 (10:45 +0000)
Fix an assertion reported by gkoehler@.

ok kettenis@

sys/uvm/uvm_fault.c
sys/uvm/uvm_pager.c

index ff4fb28..9f5da3f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvm_fault.c,v 1.130 2022/06/28 10:38:55 mpi Exp $     */
+/*     $OpenBSD: uvm_fault.c,v 1.131 2022/06/28 10:45:55 mpi Exp $     */
 /*     $NetBSD: uvm_fault.c,v 1.51 2000/08/06 00:22:53 thorpej Exp $   */
 
 /*
@@ -389,10 +389,6 @@ uvmfault_anonget(struct uvm_faultinfo *ufi, struct vm_amap *amap,
                        if (pg->pg_flags & PG_WANTED) {
                                wakeup(pg);
                        }
-                       /* un-busy! */
-                       atomic_clearbits_int(&pg->pg_flags,
-                           PG_WANTED|PG_BUSY|PG_FAKE);
-                       UVM_PAGE_OWN(pg, NULL);
 
                        /*
                         * if we were RELEASED during I/O, then our anon is
@@ -450,6 +446,9 @@ uvmfault_anonget(struct uvm_faultinfo *ufi, struct vm_amap *amap,
                        uvm_lock_pageq();
                        uvm_pageactivate(pg);
                        uvm_unlock_pageq();
+                       atomic_clearbits_int(&pg->pg_flags,
+                           PG_WANTED|PG_BUSY|PG_FAKE);
+                       UVM_PAGE_OWN(pg, NULL);
                }
 
                /*
index aa1b4ab..01d0f8b 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvm_pager.c,v 1.78 2022/02/18 09:04:38 kettenis Exp $ */
+/*     $OpenBSD: uvm_pager.c,v 1.79 2022/06/28 10:45:55 mpi Exp $      */
 /*     $NetBSD: uvm_pager.c,v 1.36 2000/11/27 18:26:41 chs Exp $       */
 
 /*
@@ -675,14 +675,8 @@ uvm_pager_dropcluster(struct uvm_object *uobj, struct vm_page *pg,
                /* if page was released, release it.  otherwise un-busy it */
                if (ppsp[lcv]->pg_flags & PG_RELEASED &&
                    ppsp[lcv]->pg_flags & PQ_ANON) {
-                               /* so that anfree will free */
-                               atomic_clearbits_int(&ppsp[lcv]->pg_flags,
-                                   PG_BUSY);
-                               UVM_PAGE_OWN(ppsp[lcv], NULL);
-
                                /* kills anon and frees pg */
                                uvm_anon_release(ppsp[lcv]->uanon);
-
                                continue;
                } else {
                        /*