Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm uvm_aio_aiodone_pages: check disposed anon correctly.



details:   https://anonhg.NetBSD.org/src/rev/1281c3d3b3e1
branches:  trunk
changeset: 768531:1281c3d3b3e1
user:      yamt <yamt%NetBSD.org@localhost>
date:      Thu Aug 18 14:17:08 2011 +0000

description:
uvm_aio_aiodone_pages: check disposed anon correctly.

diffstat:

 sys/uvm/uvm_pager.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (47 lines):

diff -r 5af2ffc0aabc -r 1281c3d3b3e1 sys/uvm/uvm_pager.c
--- a/sys/uvm/uvm_pager.c       Thu Aug 18 14:13:59 2011 +0000
+++ b/sys/uvm/uvm_pager.c       Thu Aug 18 14:17:08 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_pager.c,v 1.101 2011/06/12 03:36:03 rmind Exp $    */
+/*     $NetBSD: uvm_pager.c,v 1.102 2011/08/18 14:17:08 yamt Exp $     */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.101 2011/06/12 03:36:03 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.102 2011/08/18 14:17:08 yamt Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_readahead.h"
@@ -300,6 +300,8 @@
 #endif /* defined(VMSWAP) */
        }
        for (i = 0; i < npages; i++) {
+               bool anon_disposed = false; /* XXX gcc */
+
                pg = pgs[i];
                KASSERT(swap || pg->uobject == uobj);
                UVMHIST_LOG(ubchist, "pg %p", pg, 0,0,0);
@@ -318,6 +320,9 @@
                        }
                        mutex_enter(slock);
                        mutex_enter(&uvm_pageqlock);
+                       anon_disposed = (pg->flags & PG_RELEASED) != 0;
+                       KASSERT(!anon_disposed || pg->uobject != NULL ||
+                           pg->uanon->an_ref == 0);
                }
 #endif /* defined(VMSWAP) */
 
@@ -399,8 +404,7 @@
                 */
 
                if (swap) {
-                       if (pg->uobject == NULL && pg->uanon->an_ref == 0 &&
-                           (pg->flags & PG_RELEASED) != 0) {
+                       if (pg->uobject == NULL && anon_disposed) {
                                mutex_exit(&uvm_pageqlock);
                                uvm_anon_release(pg->uanon);
                        } else {



Home | Main Index | Thread Index | Old Index