Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm in uao_get(), if we unlock the uobj to read a page f...



details:   https://anonhg.NetBSD.org/src/rev/d192f5f2632e
branches:  trunk
changeset: 942780:d192f5f2632e
user:      chs <chs%NetBSD.org@localhost>
date:      Wed Aug 19 15:36:41 2020 +0000

description:
in uao_get(), if we unlock the uobj to read a page from swap,
we must clear the cached page array because it is now stale.
also add a missing call to uvm_page_array_fini() if the I/O fails.
fixes PR 55493.

diffstat:

 sys/uvm/uvm_aobj.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 2f40966331e3 -r d192f5f2632e sys/uvm/uvm_aobj.c
--- a/sys/uvm/uvm_aobj.c        Wed Aug 19 13:11:42 2020 +0000
+++ b/sys/uvm/uvm_aobj.c        Wed Aug 19 15:36:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_aobj.c,v 1.150 2020/08/19 07:29:00 simonb Exp $    */
+/*     $NetBSD: uvm_aobj.c,v 1.151 2020/08/19 15:36:41 chs Exp $       */
 
 /*
  * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.150 2020/08/19 07:29:00 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.151 2020/08/19 15:36:41 chs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_uvmhist.h"
@@ -982,6 +982,7 @@
                         * unlock object for i/o, relock when done.
                         */
 
+                       uvm_page_array_clear(&a);
                        rw_exit(uobj->vmobjlock);
                        error = uvm_swap_get(ptmp, swslot, PGO_SYNCIO);
                        rw_enter(uobj->vmobjlock, RW_WRITER);
@@ -1015,6 +1016,7 @@
                                        uvm_page_unbusy(pps, lcv);
                                }
                                memset(pps, 0, maxpages * sizeof(pps[0]));
+                               uvm_page_array_fini(&a);
                                return error;
                        }
 #else /* defined(VMSWAP) */



Home | Main Index | Thread Index | Old Index