Module Name: src Committed By: ad Date: Mon Feb 24 20:18:53 UTC 2020
Modified Files: src/sys/nfs: nfs_subs.c Log Message: v_interlock -> vmobjlock To generate a diff of this commit: cvs rdiff -u -r1.236 -r1.237 src/sys/nfs/nfs_subs.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/nfs/nfs_subs.c diff -u src/sys/nfs/nfs_subs.c:1.236 src/sys/nfs/nfs_subs.c:1.237 --- src/sys/nfs/nfs_subs.c:1.236 Sun Dec 15 21:11:34 2019 +++ src/sys/nfs/nfs_subs.c Mon Feb 24 20:18:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_subs.c,v 1.236 2019/12/15 21:11:34 ad Exp $ */ +/* $NetBSD: nfs_subs.c,v 1.237 2020/02/24 20:18:53 ad Exp $ */ /* * Copyright (c) 1989, 1993 @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.236 2019/12/15 21:11:34 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.237 2020/02/24 20:18:53 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_nfs.h" @@ -1751,28 +1751,13 @@ nfs_clearcommit_selector(void *cl, struc { struct nfs_clearcommit_ctx *c = cl; struct nfsnode *np; - struct vm_page *pg; - struct uvm_page_array a; - voff_t off; KASSERT(mutex_owned(vp->v_interlock)); + /* XXXAD mountpoint check looks like nonsense to me */ np = VTONFS(vp); if (vp->v_type != VREG || vp->v_mount != c->mp || np == NULL) return false; - np->n_pushlo = np->n_pushhi = np->n_pushedlo = - np->n_pushedhi = 0; - np->n_commitflags &= - ~(NFS_COMMIT_PUSH_VALID | NFS_COMMIT_PUSHED_VALID); - uvm_page_array_init(&a); - off = 0; - while ((pg = uvm_page_array_fill_and_peek(&a, &vp->v_uobj, off, - 0, 0)) != NULL) { - pg->flags &= ~PG_NEEDCOMMIT; - uvm_page_array_advance(&a); - off = pg->offset + PAGE_SIZE; - } - uvm_page_array_fini(&a); return false; } @@ -1786,15 +1771,41 @@ nfs_clearcommit_selector(void *cl, struc void nfs_clearcommit(struct mount *mp) { - struct vnode *vp __diagused; + struct vnode *vp; struct vnode_iterator *marker; struct nfsmount *nmp = VFSTONFS(mp); struct nfs_clearcommit_ctx ctx; + struct nfsnode *np; + struct vm_page *pg; + struct uvm_page_array a; + voff_t off; rw_enter(&nmp->nm_writeverflock, RW_WRITER); vfs_vnode_iterator_init(mp, &marker); ctx.mp = mp; - vp = vfs_vnode_iterator_next(marker, nfs_clearcommit_selector, &ctx); + for (;;) { + vp = vfs_vnode_iterator_next(marker, nfs_clearcommit_selector, + &ctx); + if (vp == NULL) + break; + rw_enter(vp->v_uobj.vmobjlock, RW_WRITER); + np = VTONFS(vp); + np->n_pushlo = np->n_pushhi = np->n_pushedlo = + np->n_pushedhi = 0; + np->n_commitflags &= + ~(NFS_COMMIT_PUSH_VALID | NFS_COMMIT_PUSHED_VALID); + uvm_page_array_init(&a); + off = 0; + while ((pg = uvm_page_array_fill_and_peek(&a, &vp->v_uobj, off, + 0, 0)) != NULL) { + pg->flags &= ~PG_NEEDCOMMIT; + uvm_page_array_advance(&a); + off = pg->offset + PAGE_SIZE; + } + uvm_page_array_fini(&a); + rw_exit(vp->v_uobj.vmobjlock); + vrele(vp); + } KASSERT(vp == NULL); vfs_vnode_iterator_destroy(marker); mutex_enter(&nmp->nm_lock);