Module Name:    src
Committed By:   mlelstv
Date:           Sun Oct  6 05:48:00 UTC 2019

Modified Files:
        src/sys/miscfs/genfs: genfs_io.c
        src/sys/uvm: uvm_swap.c

Log Message:
Defer to synchronous I/O before the aiodone work queue exists.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/miscfs/genfs/genfs_io.c
cvs rdiff -u -r1.180 -r1.181 src/sys/uvm/uvm_swap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/miscfs/genfs/genfs_io.c
diff -u src/sys/miscfs/genfs/genfs_io.c:1.75 src/sys/miscfs/genfs/genfs_io.c:1.76
--- src/sys/miscfs/genfs/genfs_io.c:1.75	Thu Jul 11 16:59:14 2019
+++ src/sys/miscfs/genfs/genfs_io.c	Sun Oct  6 05:48:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_io.c,v 1.75 2019/07/11 16:59:14 maxv Exp $	*/
+/*	$NetBSD: genfs_io.c,v 1.76 2019/10/06 05:48:00 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.75 2019/07/11 16:59:14 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.76 2019/10/06 05:48:00 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -561,6 +561,9 @@ genfs_getpages_read(struct vnode *vp, st
 	if (kva == 0)
 		return EBUSY;
 
+	if (uvm.aiodone_queue == NULL)
+		async = 0;
+
 	mbp = getiobuf(vp, true);
 	mbp->b_bufsize = totalbytes;
 	mbp->b_data = (void *)kva;
@@ -1377,6 +1380,7 @@ genfs_gop_write(struct vnode *vp, struct
 	    UVMPAGER_MAPIN_WRITE | UVMPAGER_MAPIN_WAITOK);
 	len = npages << PAGE_SHIFT;
 
+	KASSERT(uvm.aiodone_queue != NULL);
 	error = genfs_do_io(vp, off, kva, len, flags, UIO_WRITE,
 			    uvm_aio_biodone);
 
@@ -1400,6 +1404,7 @@ genfs_gop_write_rwmap(struct vnode *vp, 
 	    UVMPAGER_MAPIN_READ | UVMPAGER_MAPIN_WAITOK);
 	len = npages << PAGE_SHIFT;
 
+	KASSERT(uvm.aiodone_queue != NULL);
 	error = genfs_do_io(vp, off, kva, len, flags, UIO_WRITE,
 			    uvm_aio_biodone);
 

Index: src/sys/uvm/uvm_swap.c
diff -u src/sys/uvm/uvm_swap.c:1.180 src/sys/uvm/uvm_swap.c:1.181
--- src/sys/uvm/uvm_swap.c:1.180	Sun Jan 27 05:22:19 2019
+++ src/sys/uvm/uvm_swap.c	Sun Oct  6 05:48:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_swap.c,v 1.180 2019/01/27 05:22:19 kre Exp $	*/
+/*	$NetBSD: uvm_swap.c,v 1.181 2019/10/06 05:48:00 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.180 2019/01/27 05:22:19 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.181 2019/10/06 05:48:00 mlelstv Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_compat_netbsd.h"
@@ -1778,6 +1778,10 @@ uvm_swap_io(struct vm_page **pps, int st
 	write = (flags & B_READ) == 0;
 	async = (flags & B_ASYNC) != 0;
 
+	/* XXX swap io make take place before the aiodone queue exists */
+	if (uvm.aiodone_queue == NULL)
+		async = 0;
+
 	/*
 	 * allocate a buf for the i/o.
 	 */
@@ -1832,6 +1836,7 @@ uvm_swap_io(struct vm_page **pps, int st
 	 */
 
 	if (async) {
+		KASSERT(uvm.aiodone_queue != NULL);
 		bp->b_iodone = uvm_aio_biodone;
 		UVMHIST_LOG(pdhist, "doing async!", 0, 0, 0, 0);
 		if (curlwp == uvm.pagedaemon_lwp)

Reply via email to