Source-Changes-HG archive

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

[src/trunk]: src/sys/nfs v_interlock -> vmobjlock



details:   https://anonhg.NetBSD.org/src/rev/7af967538035
branches:  trunk
changeset: 1007648:7af967538035
user:      ad <ad%NetBSD.org@localhost>
date:      Mon Feb 24 20:11:45 2020 +0000

description:
v_interlock -> vmobjlock

diffstat:

 sys/nfs/nfs_node.c |   8 ++++----
 sys/nfs/nfs_subs.c |  51 +++++++++++++++++++++++++++++++--------------------
 2 files changed, 35 insertions(+), 24 deletions(-)

diffs (124 lines):

diff -r 7eb8ac3b34d3 -r 7af967538035 sys/nfs/nfs_node.c
--- a/sys/nfs/nfs_node.c        Mon Feb 24 18:39:47 2020 +0000
+++ b/sys/nfs/nfs_node.c        Mon Feb 24 20:11:45 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_node.c,v 1.124 2019/10/18 04:09:02 msaitoh Exp $   */
+/*     $NetBSD: nfs_node.c,v 1.125 2020/02/24 20:11:45 ad Exp $        */
 
 /*
  * Copyright (c) 1989, 1993
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_node.c,v 1.124 2019/10/18 04:09:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_node.c,v 1.125 2020/02/24 20:11:45 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_nfs.h"
@@ -273,11 +273,11 @@
 {
        int i;
 
-       mutex_enter(vp->v_interlock);
+       rw_enter(vp->v_uobj.vmobjlock, RW_WRITER);
        for (i = 0; i < npages; i++) {
                pmap_page_protect(pgs[i], VM_PROT_READ);
        }
-       mutex_exit(vp->v_interlock);
+       rw_exit(vp->v_uobj.vmobjlock);
 
        return genfs_gop_write(vp, pgs, npages, flags);
 }
diff -r 7eb8ac3b34d3 -r 7af967538035 sys/nfs/nfs_subs.c
--- a/sys/nfs/nfs_subs.c        Mon Feb 24 18:39:47 2020 +0000
+++ b/sys/nfs/nfs_subs.c        Mon Feb 24 20:11:45 2020 +0000
@@ -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 @@
 {
        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 @@
 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);



Home | Main Index | Thread Index | Old Index