Module Name:    src
Committed By:   chs
Date:           Sun Nov 15 00:54:13 UTC 2020

Modified Files:
        src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c

Log Message:
Commit the ZFS file that I forgot in this previous commit:

Move the handling of PG_PAGEOUT from uvm_aio_aiodone_pages() to
uvm_page_unbusy() so that all callers of uvm_page_unbusy() don't need to
handle this flag separately.  Split out the pages part of uvm_aio_aiodone()
into uvm_aio_aiodone_pages() in rump just like in the real kernel.
In ZFS functions that can fail to copy data between the ARC and VM pages,
use uvm_aio_aiodone_pages() rather than uvm_page_unbusy() so that we can
handle these "I/O" errors.  Fixes PR 55702.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 \
    src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.70 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.71
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.70	Thu Aug 27 09:57:33 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Sun Nov 15 00:54:13 2020
@@ -6049,20 +6049,13 @@ zfs_netbsd_getpages(void *v)
 			    PAGE_SIZE, va, DMU_READ_PREFETCH);
 			zfs_unmap_page(pg, va);
 
-			rw_enter(rw, RW_WRITER);
 			if (err != 0) {
-				for (i = 0; i < npages; i++) {
-					pg = ap->a_m[i];
-					if ((pg->flags & PG_FAKE) != 0) {
-						uvm_pagefree(pg);
-					} else {
-						uvm_page_unbusy(&pg, 1);
-					}
-				}
+				uvm_aio_aiodone_pages(ap->a_m, npages, false, err);
 				memset(ap->a_m, 0, sizeof(ap->a_m[0]) *
 				    npages);
 				break;
 			}
+			rw_enter(rw, RW_WRITER);
 			pg->flags &= ~(PG_FAKE);
 		}
 
@@ -6089,14 +6082,13 @@ zfs_putapage(vnode_t *vp, page_t **pp, i
 	voff_t		len, klen;
 	int		err;
 
-	bool async = (flags & PGO_SYNCIO) == 0;
 	bool *cleanedp;
 	struct uvm_object *uobj = &vp->v_uobj;
 	krwlock_t *rw = uobj->vmobjlock;
 
 	if (zp->z_sa_hdl == NULL) {
 		err = 0;
-		goto out_unbusy;
+		goto out;
 	}
 
 	/*
@@ -6170,12 +6162,8 @@ zfs_putapage(vnode_t *vp, page_t **pp, i
 	}
 	dmu_tx_commit(tx);
 
-out_unbusy:
-	rw_enter(rw, RW_WRITER);
-	uvm_page_unbusy(pp, count);
-	rw_exit(rw);
-
 out:
+	uvm_aio_aiodone_pages(pp, count, true, err);
 	return (err);
 }
 

Reply via email to