Home | History | Annotate | Line # | Download | only in nfs
nfs_node.c revision 1.95.10.2
      1  1.95.10.2  yamt /*	$NetBSD: nfs_node.c,v 1.95.10.2 2007/08/06 11:55:09 yamt Exp $	*/
      2  1.95.10.2  yamt 
      3  1.95.10.2  yamt /*
      4  1.95.10.2  yamt  * Copyright (c) 1989, 1993
      5  1.95.10.2  yamt  *	The Regents of the University of California.  All rights reserved.
      6  1.95.10.2  yamt  *
      7  1.95.10.2  yamt  * This code is derived from software contributed to Berkeley by
      8  1.95.10.2  yamt  * Rick Macklem at The University of Guelph.
      9  1.95.10.2  yamt  *
     10  1.95.10.2  yamt  * Redistribution and use in source and binary forms, with or without
     11  1.95.10.2  yamt  * modification, are permitted provided that the following conditions
     12  1.95.10.2  yamt  * are met:
     13  1.95.10.2  yamt  * 1. Redistributions of source code must retain the above copyright
     14  1.95.10.2  yamt  *    notice, this list of conditions and the following disclaimer.
     15  1.95.10.2  yamt  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.95.10.2  yamt  *    notice, this list of conditions and the following disclaimer in the
     17  1.95.10.2  yamt  *    documentation and/or other materials provided with the distribution.
     18  1.95.10.2  yamt  * 3. Neither the name of the University nor the names of its contributors
     19  1.95.10.2  yamt  *    may be used to endorse or promote products derived from this software
     20  1.95.10.2  yamt  *    without specific prior written permission.
     21  1.95.10.2  yamt  *
     22  1.95.10.2  yamt  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23  1.95.10.2  yamt  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24  1.95.10.2  yamt  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25  1.95.10.2  yamt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26  1.95.10.2  yamt  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27  1.95.10.2  yamt  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28  1.95.10.2  yamt  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29  1.95.10.2  yamt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30  1.95.10.2  yamt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31  1.95.10.2  yamt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32  1.95.10.2  yamt  * SUCH DAMAGE.
     33  1.95.10.2  yamt  *
     34  1.95.10.2  yamt  *	@(#)nfs_node.c	8.6 (Berkeley) 5/22/95
     35  1.95.10.2  yamt  */
     36  1.95.10.2  yamt 
     37  1.95.10.2  yamt #include <sys/cdefs.h>
     38  1.95.10.2  yamt __KERNEL_RCSID(0, "$NetBSD: nfs_node.c,v 1.95.10.2 2007/08/06 11:55:09 yamt Exp $");
     39  1.95.10.2  yamt 
     40  1.95.10.2  yamt #include "opt_nfs.h"
     41  1.95.10.2  yamt 
     42  1.95.10.2  yamt #include <sys/param.h>
     43  1.95.10.2  yamt #include <sys/systm.h>
     44  1.95.10.2  yamt #include <sys/proc.h>
     45  1.95.10.2  yamt #include <sys/mount.h>
     46  1.95.10.2  yamt #include <sys/namei.h>
     47  1.95.10.2  yamt #include <sys/vnode.h>
     48  1.95.10.2  yamt #include <sys/kernel.h>
     49  1.95.10.2  yamt #include <sys/malloc.h>
     50  1.95.10.2  yamt #include <sys/pool.h>
     51  1.95.10.2  yamt #include <sys/lock.h>
     52  1.95.10.2  yamt #include <sys/hash.h>
     53  1.95.10.2  yamt #include <sys/kauth.h>
     54  1.95.10.2  yamt 
     55  1.95.10.2  yamt #include <nfs/rpcv2.h>
     56  1.95.10.2  yamt #include <nfs/nfsproto.h>
     57  1.95.10.2  yamt #include <nfs/nfs.h>
     58  1.95.10.2  yamt #include <nfs/nfsnode.h>
     59  1.95.10.2  yamt #include <nfs/nfsmount.h>
     60  1.95.10.2  yamt #include <nfs/nfs_var.h>
     61  1.95.10.2  yamt 
     62  1.95.10.2  yamt struct nfsnodehashhead *nfsnodehashtbl;
     63  1.95.10.2  yamt u_long nfsnodehash;
     64  1.95.10.2  yamt struct lock nfs_hashlock;
     65  1.95.10.2  yamt 
     66  1.95.10.2  yamt POOL_INIT(nfs_node_pool, sizeof(struct nfsnode), 0, 0, 0, "nfsnodepl",
     67  1.95.10.2  yamt     &pool_allocator_nointr, IPL_NONE);
     68  1.95.10.2  yamt POOL_INIT(nfs_vattr_pool, sizeof(struct vattr), 0, 0, 0, "nfsvapl",
     69  1.95.10.2  yamt     &pool_allocator_nointr, IPL_NONE);
     70  1.95.10.2  yamt 
     71  1.95.10.2  yamt MALLOC_DEFINE(M_NFSBIGFH, "NFS bigfh", "NFS big filehandle");
     72  1.95.10.2  yamt MALLOC_DEFINE(M_NFSNODE, "NFS node", "NFS vnode private part");
     73  1.95.10.2  yamt 
     74  1.95.10.2  yamt extern int prtactive;
     75  1.95.10.2  yamt 
     76  1.95.10.2  yamt #define	nfs_hash(x,y)	hash32_buf((x), (y), HASH32_BUF_INIT)
     77  1.95.10.2  yamt 
     78  1.95.10.2  yamt void nfs_gop_size(struct vnode *, off_t, off_t *, int);
     79  1.95.10.2  yamt int nfs_gop_alloc(struct vnode *, off_t, off_t, int, kauth_cred_t);
     80  1.95.10.2  yamt int nfs_gop_write(struct vnode *, struct vm_page **, int, int);
     81  1.95.10.2  yamt 
     82  1.95.10.2  yamt static const struct genfs_ops nfs_genfsops = {
     83  1.95.10.2  yamt 	.gop_size = nfs_gop_size,
     84  1.95.10.2  yamt 	.gop_alloc = nfs_gop_alloc,
     85  1.95.10.2  yamt 	.gop_write = nfs_gop_write,
     86  1.95.10.2  yamt };
     87  1.95.10.2  yamt 
     88  1.95.10.2  yamt /*
     89  1.95.10.2  yamt  * Initialize hash links for nfsnodes
     90  1.95.10.2  yamt  * and build nfsnode free list.
     91  1.95.10.2  yamt  */
     92  1.95.10.2  yamt void
     93  1.95.10.2  yamt nfs_nhinit()
     94  1.95.10.2  yamt {
     95  1.95.10.2  yamt 
     96  1.95.10.2  yamt 	nfsnodehashtbl = hashinit(desiredvnodes, HASH_LIST, M_NFSNODE,
     97  1.95.10.2  yamt 	    M_WAITOK, &nfsnodehash);
     98  1.95.10.2  yamt 	lockinit(&nfs_hashlock, PINOD, "nfs_hashlock", 0, 0);
     99  1.95.10.2  yamt }
    100  1.95.10.2  yamt 
    101  1.95.10.2  yamt /*
    102  1.95.10.2  yamt  * Reinitialize inode hash table.
    103  1.95.10.2  yamt  */
    104  1.95.10.2  yamt 
    105  1.95.10.2  yamt void
    106  1.95.10.2  yamt nfs_nhreinit()
    107  1.95.10.2  yamt {
    108  1.95.10.2  yamt 	struct nfsnode *np;
    109  1.95.10.2  yamt 	struct nfsnodehashhead *oldhash, *hash;
    110  1.95.10.2  yamt 	u_long oldmask, mask, val;
    111  1.95.10.2  yamt 	int i;
    112  1.95.10.2  yamt 
    113  1.95.10.2  yamt 	hash = hashinit(desiredvnodes, HASH_LIST, M_NFSNODE, M_WAITOK,
    114  1.95.10.2  yamt 	    &mask);
    115  1.95.10.2  yamt 
    116  1.95.10.2  yamt 	lockmgr(&nfs_hashlock, LK_EXCLUSIVE, NULL);
    117  1.95.10.2  yamt 	oldhash = nfsnodehashtbl;
    118  1.95.10.2  yamt 	oldmask = nfsnodehash;
    119  1.95.10.2  yamt 	nfsnodehashtbl = hash;
    120  1.95.10.2  yamt 	nfsnodehash = mask;
    121  1.95.10.2  yamt 	for (i = 0; i <= oldmask; i++) {
    122  1.95.10.2  yamt 		while ((np = LIST_FIRST(&oldhash[i])) != NULL) {
    123  1.95.10.2  yamt 			LIST_REMOVE(np, n_hash);
    124  1.95.10.2  yamt 			val = NFSNOHASH(nfs_hash(np->n_fhp, np->n_fhsize));
    125  1.95.10.2  yamt 			LIST_INSERT_HEAD(&hash[val], np, n_hash);
    126  1.95.10.2  yamt 		}
    127  1.95.10.2  yamt 	}
    128  1.95.10.2  yamt 	lockmgr(&nfs_hashlock, LK_RELEASE, NULL);
    129  1.95.10.2  yamt 	hashdone(oldhash, M_NFSNODE);
    130  1.95.10.2  yamt }
    131  1.95.10.2  yamt 
    132  1.95.10.2  yamt /*
    133  1.95.10.2  yamt  * Free resources previoslu allocated in nfs_nhinit().
    134  1.95.10.2  yamt  */
    135  1.95.10.2  yamt void
    136  1.95.10.2  yamt nfs_nhdone()
    137  1.95.10.2  yamt {
    138  1.95.10.2  yamt 	hashdone(nfsnodehashtbl, M_NFSNODE);
    139  1.95.10.2  yamt 	pool_destroy(&nfs_node_pool);
    140  1.95.10.2  yamt 	pool_destroy(&nfs_vattr_pool);
    141  1.95.10.2  yamt }
    142  1.95.10.2  yamt 
    143  1.95.10.2  yamt /*
    144  1.95.10.2  yamt  * Look up a vnode/nfsnode by file handle.
    145  1.95.10.2  yamt  * Callers must check for mount points!!
    146  1.95.10.2  yamt  * In all cases, a pointer to a
    147  1.95.10.2  yamt  * nfsnode structure is returned.
    148  1.95.10.2  yamt  */
    149  1.95.10.2  yamt int
    150  1.95.10.2  yamt nfs_nget1(mntp, fhp, fhsize, npp, lkflags)
    151  1.95.10.2  yamt 	struct mount *mntp;
    152  1.95.10.2  yamt 	nfsfh_t *fhp;
    153  1.95.10.2  yamt 	int fhsize;
    154  1.95.10.2  yamt 	struct nfsnode **npp;
    155  1.95.10.2  yamt 	int lkflags;
    156  1.95.10.2  yamt {
    157  1.95.10.2  yamt 	struct nfsnode *np;
    158  1.95.10.2  yamt 	struct nfsnodehashhead *nhpp;
    159  1.95.10.2  yamt 	struct vnode *vp;
    160  1.95.10.2  yamt 	int error;
    161  1.95.10.2  yamt 
    162  1.95.10.2  yamt 	nhpp = &nfsnodehashtbl[NFSNOHASH(nfs_hash(fhp, fhsize))];
    163  1.95.10.2  yamt loop:
    164  1.95.10.2  yamt 	LIST_FOREACH(np, nhpp, n_hash) {
    165  1.95.10.2  yamt 		if (mntp != NFSTOV(np)->v_mount || np->n_fhsize != fhsize ||
    166  1.95.10.2  yamt 		    memcmp(fhp, np->n_fhp, fhsize))
    167  1.95.10.2  yamt 			continue;
    168  1.95.10.2  yamt 		vp = NFSTOV(np);
    169  1.95.10.2  yamt 		error = vget(vp, LK_EXCLUSIVE | lkflags);
    170  1.95.10.2  yamt 		if (error == EBUSY)
    171  1.95.10.2  yamt 			return error;
    172  1.95.10.2  yamt 		if (error)
    173  1.95.10.2  yamt 			goto loop;
    174  1.95.10.2  yamt 		*npp = np;
    175  1.95.10.2  yamt 		return(0);
    176  1.95.10.2  yamt 	}
    177  1.95.10.2  yamt 	if (lockmgr(&nfs_hashlock, LK_EXCLUSIVE|LK_SLEEPFAIL, 0))
    178  1.95.10.2  yamt 		goto loop;
    179  1.95.10.2  yamt 	error = getnewvnode(VT_NFS, mntp, nfsv2_vnodeop_p, &vp);
    180  1.95.10.2  yamt 	if (error) {
    181  1.95.10.2  yamt 		*npp = 0;
    182  1.95.10.2  yamt 		lockmgr(&nfs_hashlock, LK_RELEASE, 0);
    183  1.95.10.2  yamt 		return (error);
    184  1.95.10.2  yamt 	}
    185  1.95.10.2  yamt 	np = pool_get(&nfs_node_pool, PR_WAITOK);
    186  1.95.10.2  yamt 	memset(np, 0, sizeof *np);
    187  1.95.10.2  yamt 	vp->v_data = np;
    188  1.95.10.2  yamt 	np->n_vnode = vp;
    189  1.95.10.2  yamt 	genfs_node_init(vp, &nfs_genfsops);
    190  1.95.10.2  yamt 
    191  1.95.10.2  yamt 	/*
    192  1.95.10.2  yamt 	 * Insert the nfsnode in the hash queue for its new file handle
    193  1.95.10.2  yamt 	 */
    194  1.95.10.2  yamt 
    195  1.95.10.2  yamt 	LIST_INSERT_HEAD(nhpp, np, n_hash);
    196  1.95.10.2  yamt 	if (fhsize > NFS_SMALLFH) {
    197  1.95.10.2  yamt 		np->n_fhp = malloc(fhsize, M_NFSBIGFH, M_WAITOK);
    198  1.95.10.2  yamt 	} else
    199  1.95.10.2  yamt 		np->n_fhp = &np->n_fh;
    200  1.95.10.2  yamt 	memcpy(np->n_fhp, fhp, fhsize);
    201  1.95.10.2  yamt 	np->n_fhsize = fhsize;
    202  1.95.10.2  yamt 	np->n_accstamp = -1;
    203  1.95.10.2  yamt 	np->n_vattr = pool_get(&nfs_vattr_pool, PR_WAITOK);
    204  1.95.10.2  yamt 
    205  1.95.10.2  yamt 	/*
    206  1.95.10.2  yamt 	 * Initalize read/write creds to useful values. VOP_OPEN will
    207  1.95.10.2  yamt 	 * overwrite these.
    208  1.95.10.2  yamt 	 */
    209  1.95.10.2  yamt 	np->n_rcred = curlwp->l_cred;
    210  1.95.10.2  yamt 	kauth_cred_hold(np->n_rcred);
    211  1.95.10.2  yamt 	np->n_wcred = curlwp->l_cred;
    212  1.95.10.2  yamt 	kauth_cred_hold(np->n_wcred);
    213  1.95.10.2  yamt 	lockmgr(&vp->v_lock, LK_EXCLUSIVE, NULL);
    214  1.95.10.2  yamt 	lockmgr(&nfs_hashlock, LK_RELEASE, NULL);
    215  1.95.10.2  yamt 	NFS_INVALIDATE_ATTRCACHE(np);
    216  1.95.10.2  yamt 	uvm_vnp_setsize(vp, 0);
    217  1.95.10.2  yamt 	*npp = np;
    218  1.95.10.2  yamt 	return (0);
    219  1.95.10.2  yamt }
    220  1.95.10.2  yamt 
    221  1.95.10.2  yamt int
    222  1.95.10.2  yamt nfs_inactive(v)
    223  1.95.10.2  yamt 	void *v;
    224  1.95.10.2  yamt {
    225  1.95.10.2  yamt 	struct vop_inactive_args /* {
    226  1.95.10.2  yamt 		struct vnode *a_vp;
    227  1.95.10.2  yamt 		struct lwp *a_l;
    228  1.95.10.2  yamt 	} */ *ap = v;
    229  1.95.10.2  yamt 	struct nfsnode *np;
    230  1.95.10.2  yamt 	struct sillyrename *sp;
    231  1.95.10.2  yamt 	struct lwp *l = ap->a_l;
    232  1.95.10.2  yamt 	struct vnode *vp = ap->a_vp;
    233  1.95.10.2  yamt 	bool removed;
    234  1.95.10.2  yamt 
    235  1.95.10.2  yamt 	np = VTONFS(vp);
    236  1.95.10.2  yamt 	if (prtactive && vp->v_usecount != 0)
    237  1.95.10.2  yamt 		vprint("nfs_inactive: pushing active", vp);
    238  1.95.10.2  yamt 	if (vp->v_type != VDIR) {
    239  1.95.10.2  yamt 		sp = np->n_sillyrename;
    240  1.95.10.2  yamt 		np->n_sillyrename = (struct sillyrename *)0;
    241  1.95.10.2  yamt 	} else
    242  1.95.10.2  yamt 		sp = NULL;
    243  1.95.10.2  yamt 	if (sp != NULL)
    244  1.95.10.2  yamt 		nfs_vinvalbuf(vp, 0, sp->s_cred, l, 1);
    245  1.95.10.2  yamt 	removed = (np->n_flag & NREMOVED) != 0;
    246  1.95.10.2  yamt 	np->n_flag &=
    247  1.95.10.2  yamt 	    (NMODIFIED | NFLUSHINPROG | NFLUSHWANT | NEOFVALID | NTRUNCDELAYED);
    248  1.95.10.2  yamt 
    249  1.95.10.2  yamt 	if (vp->v_type == VDIR && np->n_dircache)
    250  1.95.10.2  yamt 		nfs_invaldircache(vp,
    251  1.95.10.2  yamt 		    NFS_INVALDIRCACHE_FORCE | NFS_INVALDIRCACHE_KEEPEOF);
    252  1.95.10.2  yamt 
    253  1.95.10.2  yamt 	VOP_UNLOCK(vp, 0);
    254  1.95.10.2  yamt 
    255  1.95.10.2  yamt 	/* XXXMP only kernel_lock protects vp */
    256  1.95.10.2  yamt 	if (removed)
    257  1.95.10.2  yamt 		vrecycle(vp, NULL, l);
    258  1.95.10.2  yamt 
    259  1.95.10.2  yamt 	if (sp != NULL) {
    260  1.95.10.2  yamt 		int error;
    261  1.95.10.2  yamt 
    262  1.95.10.2  yamt 		/*
    263  1.95.10.2  yamt 		 * Remove the silly file that was rename'd earlier
    264  1.95.10.2  yamt 		 *
    265  1.95.10.2  yamt 		 * Just in case our thread also has the parent node locked,
    266  1.95.10.2  yamt 		 * we use LK_CANRECURSE.
    267  1.95.10.2  yamt 		 */
    268  1.95.10.2  yamt 
    269  1.95.10.2  yamt 		error = vn_lock(sp->s_dvp, LK_EXCLUSIVE | LK_CANRECURSE);
    270  1.95.10.2  yamt 		if (error || sp->s_dvp->v_data == NULL) {
    271  1.95.10.2  yamt 			/* XXX should recover */
    272  1.95.10.2  yamt 			printf("%s: vp=%p error=%d\n",
    273  1.95.10.2  yamt 			    __func__, sp->s_dvp, error);
    274  1.95.10.2  yamt 		} else {
    275  1.95.10.2  yamt 			nfs_removeit(sp);
    276  1.95.10.2  yamt 		}
    277  1.95.10.2  yamt 		kauth_cred_free(sp->s_cred);
    278  1.95.10.2  yamt 		vput(sp->s_dvp);
    279  1.95.10.2  yamt 		FREE(sp, M_NFSREQ);
    280  1.95.10.2  yamt 	}
    281  1.95.10.2  yamt 
    282  1.95.10.2  yamt 	return (0);
    283  1.95.10.2  yamt }
    284  1.95.10.2  yamt 
    285  1.95.10.2  yamt /*
    286  1.95.10.2  yamt  * Reclaim an nfsnode so that it can be used for other purposes.
    287  1.95.10.2  yamt  */
    288  1.95.10.2  yamt int
    289  1.95.10.2  yamt nfs_reclaim(v)
    290  1.95.10.2  yamt 	void *v;
    291  1.95.10.2  yamt {
    292  1.95.10.2  yamt 	struct vop_reclaim_args /* {
    293  1.95.10.2  yamt 		struct vnode *a_vp;
    294  1.95.10.2  yamt 	} */ *ap = v;
    295  1.95.10.2  yamt 	struct vnode *vp = ap->a_vp;
    296  1.95.10.2  yamt 	struct nfsnode *np = VTONFS(vp);
    297  1.95.10.2  yamt 
    298  1.95.10.2  yamt 	if (prtactive && vp->v_usecount != 0)
    299  1.95.10.2  yamt 		vprint("nfs_reclaim: pushing active", vp);
    300  1.95.10.2  yamt 
    301  1.95.10.2  yamt 	LIST_REMOVE(np, n_hash);
    302  1.95.10.2  yamt 
    303  1.95.10.2  yamt 	/*
    304  1.95.10.2  yamt 	 * Free up any directory cookie structures and
    305  1.95.10.2  yamt 	 * large file handle structures that might be associated with
    306  1.95.10.2  yamt 	 * this nfs node.
    307  1.95.10.2  yamt 	 */
    308  1.95.10.2  yamt 	if (vp->v_type == VDIR && np->n_dircache)
    309  1.95.10.2  yamt 		hashdone(np->n_dircache, M_NFSDIROFF);
    310  1.95.10.2  yamt 	KASSERT(np->n_dirgens == NULL);
    311  1.95.10.2  yamt 
    312  1.95.10.2  yamt 	if (np->n_fhsize > NFS_SMALLFH)
    313  1.95.10.2  yamt 		free(np->n_fhp, M_NFSBIGFH);
    314  1.95.10.2  yamt 
    315  1.95.10.2  yamt 	pool_put(&nfs_vattr_pool, np->n_vattr);
    316  1.95.10.2  yamt 	if (np->n_rcred)
    317  1.95.10.2  yamt 		kauth_cred_free(np->n_rcred);
    318  1.95.10.2  yamt 
    319  1.95.10.2  yamt 	if (np->n_wcred)
    320  1.95.10.2  yamt 		kauth_cred_free(np->n_wcred);
    321  1.95.10.2  yamt 
    322  1.95.10.2  yamt 	cache_purge(vp);
    323  1.95.10.2  yamt 	if (vp->v_type == VREG) {
    324  1.95.10.2  yamt 		mutex_destroy(&np->n_commitlock);
    325  1.95.10.2  yamt 	}
    326  1.95.10.2  yamt 	genfs_node_destroy(vp);
    327  1.95.10.2  yamt 	pool_put(&nfs_node_pool, np);
    328  1.95.10.2  yamt 	vp->v_data = NULL;
    329  1.95.10.2  yamt 	return (0);
    330  1.95.10.2  yamt }
    331  1.95.10.2  yamt 
    332  1.95.10.2  yamt void
    333  1.95.10.2  yamt nfs_gop_size(struct vnode *vp, off_t size, off_t *eobp, int flags)
    334  1.95.10.2  yamt {
    335  1.95.10.2  yamt 
    336  1.95.10.2  yamt 	*eobp = MAX(size, vp->v_size);
    337  1.95.10.2  yamt }
    338  1.95.10.2  yamt 
    339  1.95.10.2  yamt int
    340  1.95.10.2  yamt nfs_gop_alloc(struct vnode *vp, off_t off, off_t len, int flags,
    341  1.95.10.2  yamt     kauth_cred_t cred)
    342  1.95.10.2  yamt {
    343  1.95.10.2  yamt 
    344  1.95.10.2  yamt 	return 0;
    345  1.95.10.2  yamt }
    346  1.95.10.2  yamt 
    347  1.95.10.2  yamt int
    348  1.95.10.2  yamt nfs_gop_write(struct vnode *vp, struct vm_page **pgs, int npages, int flags)
    349  1.95.10.2  yamt {
    350  1.95.10.2  yamt 	int i;
    351  1.95.10.2  yamt 
    352  1.95.10.2  yamt 	for (i = 0; i < npages; i++) {
    353  1.95.10.2  yamt 		pmap_page_protect(pgs[i], VM_PROT_READ);
    354  1.95.10.2  yamt 	}
    355  1.95.10.2  yamt 	return genfs_gop_write(vp, pgs, npages, flags);
    356  1.95.10.2  yamt }
    357