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/1c841fce5ba8
branches:  trunk
changeset: 937453:1c841fce5ba8
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 9096a2d19935 -r 1c841fce5ba8 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