nfs_clnode.c revision 1.1.1.1.6.2 1 1.1.1.1.6.2 yamt /* $NetBSD: nfs_clnode.c,v 1.1.1.1.6.2 2014/05/22 11:41:00 yamt Exp $ */
2 1.1.1.1.6.2 yamt /*-
3 1.1.1.1.6.2 yamt * Copyright (c) 1989, 1993
4 1.1.1.1.6.2 yamt * The Regents of the University of California. All rights reserved.
5 1.1.1.1.6.2 yamt *
6 1.1.1.1.6.2 yamt * This code is derived from software contributed to Berkeley by
7 1.1.1.1.6.2 yamt * Rick Macklem at The University of Guelph.
8 1.1.1.1.6.2 yamt *
9 1.1.1.1.6.2 yamt * Redistribution and use in source and binary forms, with or without
10 1.1.1.1.6.2 yamt * modification, are permitted provided that the following conditions
11 1.1.1.1.6.2 yamt * are met:
12 1.1.1.1.6.2 yamt * 1. Redistributions of source code must retain the above copyright
13 1.1.1.1.6.2 yamt * notice, this list of conditions and the following disclaimer.
14 1.1.1.1.6.2 yamt * 2. Redistributions in binary form must reproduce the above copyright
15 1.1.1.1.6.2 yamt * notice, this list of conditions and the following disclaimer in the
16 1.1.1.1.6.2 yamt * documentation and/or other materials provided with the distribution.
17 1.1.1.1.6.2 yamt * 4. Neither the name of the University nor the names of its contributors
18 1.1.1.1.6.2 yamt * may be used to endorse or promote products derived from this software
19 1.1.1.1.6.2 yamt * without specific prior written permission.
20 1.1.1.1.6.2 yamt *
21 1.1.1.1.6.2 yamt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 1.1.1.1.6.2 yamt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 1.1.1.1.6.2 yamt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 1.1.1.1.6.2 yamt * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 1.1.1.1.6.2 yamt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 1.1.1.1.6.2 yamt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 1.1.1.1.6.2 yamt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 1.1.1.1.6.2 yamt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 1.1.1.1.6.2 yamt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 1.1.1.1.6.2 yamt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 1.1.1.1.6.2 yamt * SUCH DAMAGE.
32 1.1.1.1.6.2 yamt *
33 1.1.1.1.6.2 yamt * from nfs_node.c 8.6 (Berkeley) 5/22/95
34 1.1.1.1.6.2 yamt */
35 1.1.1.1.6.2 yamt
36 1.1.1.1.6.2 yamt #include <sys/cdefs.h>
37 1.1.1.1.6.2 yamt /* __FBSDID("FreeBSD: head/sys/fs/nfsclient/nfs_clnode.c 248084 2013-03-09 02:32:23Z attilio "); */
38 1.1.1.1.6.2 yamt __RCSID("$NetBSD: nfs_clnode.c,v 1.1.1.1.6.2 2014/05/22 11:41:00 yamt Exp $");
39 1.1.1.1.6.2 yamt
40 1.1.1.1.6.2 yamt #include "opt_kdtrace.h"
41 1.1.1.1.6.2 yamt
42 1.1.1.1.6.2 yamt #include <sys/param.h>
43 1.1.1.1.6.2 yamt #include <sys/systm.h>
44 1.1.1.1.6.2 yamt #include <sys/fcntl.h>
45 1.1.1.1.6.2 yamt #include <sys/lock.h>
46 1.1.1.1.6.2 yamt #include <sys/malloc.h>
47 1.1.1.1.6.2 yamt #include <sys/mount.h>
48 1.1.1.1.6.2 yamt #include <sys/namei.h>
49 1.1.1.1.6.2 yamt #include <sys/proc.h>
50 1.1.1.1.6.2 yamt #include <sys/socket.h>
51 1.1.1.1.6.2 yamt #include <sys/sysctl.h>
52 1.1.1.1.6.2 yamt #include <sys/taskqueue.h>
53 1.1.1.1.6.2 yamt #include <sys/vnode.h>
54 1.1.1.1.6.2 yamt
55 1.1.1.1.6.2 yamt #include <vm/uma.h>
56 1.1.1.1.6.2 yamt
57 1.1.1.1.6.2 yamt #include <fs/nfs/nfsport.h>
58 1.1.1.1.6.2 yamt #include <fs/nfsclient/nfsnode.h>
59 1.1.1.1.6.2 yamt #include <fs/nfsclient/nfsmount.h>
60 1.1.1.1.6.2 yamt #include <fs/nfsclient/nfs.h>
61 1.1.1.1.6.2 yamt #include <fs/nfsclient/nfs_kdtrace.h>
62 1.1.1.1.6.2 yamt
63 1.1.1.1.6.2 yamt #include <nfs/nfs_lock.h>
64 1.1.1.1.6.2 yamt
65 1.1.1.1.6.2 yamt extern struct vop_vector newnfs_vnodeops;
66 1.1.1.1.6.2 yamt extern struct buf_ops buf_ops_newnfs;
67 1.1.1.1.6.2 yamt MALLOC_DECLARE(M_NEWNFSREQ);
68 1.1.1.1.6.2 yamt
69 1.1.1.1.6.2 yamt uma_zone_t newnfsnode_zone;
70 1.1.1.1.6.2 yamt
71 1.1.1.1.6.2 yamt static void nfs_freesillyrename(void *arg, __unused int pending);
72 1.1.1.1.6.2 yamt
73 1.1.1.1.6.2 yamt void
74 1.1.1.1.6.2 yamt ncl_nhinit(void)
75 1.1.1.1.6.2 yamt {
76 1.1.1.1.6.2 yamt
77 1.1.1.1.6.2 yamt newnfsnode_zone = uma_zcreate("NCLNODE", sizeof(struct nfsnode), NULL,
78 1.1.1.1.6.2 yamt NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
79 1.1.1.1.6.2 yamt }
80 1.1.1.1.6.2 yamt
81 1.1.1.1.6.2 yamt void
82 1.1.1.1.6.2 yamt ncl_nhuninit(void)
83 1.1.1.1.6.2 yamt {
84 1.1.1.1.6.2 yamt uma_zdestroy(newnfsnode_zone);
85 1.1.1.1.6.2 yamt }
86 1.1.1.1.6.2 yamt
87 1.1.1.1.6.2 yamt /*
88 1.1.1.1.6.2 yamt * ONLY USED FOR THE ROOT DIRECTORY. nfscl_nget() does the rest. If this
89 1.1.1.1.6.2 yamt * function is going to be used to get Regular Files, code must be added
90 1.1.1.1.6.2 yamt * to fill in the "struct nfsv4node".
91 1.1.1.1.6.2 yamt * Look up a vnode/nfsnode by file handle.
92 1.1.1.1.6.2 yamt * Callers must check for mount points!!
93 1.1.1.1.6.2 yamt * In all cases, a pointer to a
94 1.1.1.1.6.2 yamt * nfsnode structure is returned.
95 1.1.1.1.6.2 yamt */
96 1.1.1.1.6.2 yamt int
97 1.1.1.1.6.2 yamt ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize, struct nfsnode **npp,
98 1.1.1.1.6.2 yamt int lkflags)
99 1.1.1.1.6.2 yamt {
100 1.1.1.1.6.2 yamt struct thread *td = curthread; /* XXX */
101 1.1.1.1.6.2 yamt struct nfsnode *np;
102 1.1.1.1.6.2 yamt struct vnode *vp;
103 1.1.1.1.6.2 yamt struct vnode *nvp;
104 1.1.1.1.6.2 yamt int error;
105 1.1.1.1.6.2 yamt u_int hash;
106 1.1.1.1.6.2 yamt struct nfsmount *nmp;
107 1.1.1.1.6.2 yamt struct nfsfh *nfhp;
108 1.1.1.1.6.2 yamt
109 1.1.1.1.6.2 yamt nmp = VFSTONFS(mntp);
110 1.1.1.1.6.2 yamt *npp = NULL;
111 1.1.1.1.6.2 yamt
112 1.1.1.1.6.2 yamt hash = fnv_32_buf(fhp, fhsize, FNV1_32_INIT);
113 1.1.1.1.6.2 yamt
114 1.1.1.1.6.2 yamt MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) + fhsize,
115 1.1.1.1.6.2 yamt M_NFSFH, M_WAITOK);
116 1.1.1.1.6.2 yamt bcopy(fhp, &nfhp->nfh_fh[0], fhsize);
117 1.1.1.1.6.2 yamt nfhp->nfh_len = fhsize;
118 1.1.1.1.6.2 yamt error = vfs_hash_get(mntp, hash, lkflags,
119 1.1.1.1.6.2 yamt td, &nvp, newnfs_vncmpf, nfhp);
120 1.1.1.1.6.2 yamt FREE(nfhp, M_NFSFH);
121 1.1.1.1.6.2 yamt if (error)
122 1.1.1.1.6.2 yamt return (error);
123 1.1.1.1.6.2 yamt if (nvp != NULL) {
124 1.1.1.1.6.2 yamt *npp = VTONFS(nvp);
125 1.1.1.1.6.2 yamt return (0);
126 1.1.1.1.6.2 yamt }
127 1.1.1.1.6.2 yamt np = uma_zalloc(newnfsnode_zone, M_WAITOK | M_ZERO);
128 1.1.1.1.6.2 yamt
129 1.1.1.1.6.2 yamt error = getnewvnode("newnfs", mntp, &newnfs_vnodeops, &nvp);
130 1.1.1.1.6.2 yamt if (error) {
131 1.1.1.1.6.2 yamt uma_zfree(newnfsnode_zone, np);
132 1.1.1.1.6.2 yamt return (error);
133 1.1.1.1.6.2 yamt }
134 1.1.1.1.6.2 yamt vp = nvp;
135 1.1.1.1.6.2 yamt KASSERT(vp->v_bufobj.bo_bsize != 0, ("ncl_nget: bo_bsize == 0"));
136 1.1.1.1.6.2 yamt vp->v_bufobj.bo_ops = &buf_ops_newnfs;
137 1.1.1.1.6.2 yamt vp->v_data = np;
138 1.1.1.1.6.2 yamt np->n_vnode = vp;
139 1.1.1.1.6.2 yamt /*
140 1.1.1.1.6.2 yamt * Initialize the mutex even if the vnode is going to be a loser.
141 1.1.1.1.6.2 yamt * This simplifies the logic in reclaim, which can then unconditionally
142 1.1.1.1.6.2 yamt * destroy the mutex (in the case of the loser, or if hash_insert
143 1.1.1.1.6.2 yamt * happened to return an error no special casing is needed).
144 1.1.1.1.6.2 yamt */
145 1.1.1.1.6.2 yamt mtx_init(&np->n_mtx, "NEWNFSnode lock", NULL, MTX_DEF | MTX_DUPOK);
146 1.1.1.1.6.2 yamt /*
147 1.1.1.1.6.2 yamt * NFS supports recursive and shared locking.
148 1.1.1.1.6.2 yamt */
149 1.1.1.1.6.2 yamt lockmgr(vp->v_vnlock, LK_EXCLUSIVE | LK_NOWITNESS, NULL);
150 1.1.1.1.6.2 yamt VN_LOCK_AREC(vp);
151 1.1.1.1.6.2 yamt VN_LOCK_ASHARE(vp);
152 1.1.1.1.6.2 yamt /*
153 1.1.1.1.6.2 yamt * Are we getting the root? If so, make sure the vnode flags
154 1.1.1.1.6.2 yamt * are correct
155 1.1.1.1.6.2 yamt */
156 1.1.1.1.6.2 yamt if ((fhsize == nmp->nm_fhsize) &&
157 1.1.1.1.6.2 yamt !bcmp(fhp, nmp->nm_fh, fhsize)) {
158 1.1.1.1.6.2 yamt if (vp->v_type == VNON)
159 1.1.1.1.6.2 yamt vp->v_type = VDIR;
160 1.1.1.1.6.2 yamt vp->v_vflag |= VV_ROOT;
161 1.1.1.1.6.2 yamt }
162 1.1.1.1.6.2 yamt
163 1.1.1.1.6.2 yamt MALLOC(np->n_fhp, struct nfsfh *, sizeof (struct nfsfh) + fhsize,
164 1.1.1.1.6.2 yamt M_NFSFH, M_WAITOK);
165 1.1.1.1.6.2 yamt bcopy(fhp, np->n_fhp->nfh_fh, fhsize);
166 1.1.1.1.6.2 yamt np->n_fhp->nfh_len = fhsize;
167 1.1.1.1.6.2 yamt error = insmntque(vp, mntp);
168 1.1.1.1.6.2 yamt if (error != 0) {
169 1.1.1.1.6.2 yamt *npp = NULL;
170 1.1.1.1.6.2 yamt FREE((caddr_t)np->n_fhp, M_NFSFH);
171 1.1.1.1.6.2 yamt mtx_destroy(&np->n_mtx);
172 1.1.1.1.6.2 yamt uma_zfree(newnfsnode_zone, np);
173 1.1.1.1.6.2 yamt return (error);
174 1.1.1.1.6.2 yamt }
175 1.1.1.1.6.2 yamt error = vfs_hash_insert(vp, hash, lkflags,
176 1.1.1.1.6.2 yamt td, &nvp, newnfs_vncmpf, np->n_fhp);
177 1.1.1.1.6.2 yamt if (error)
178 1.1.1.1.6.2 yamt return (error);
179 1.1.1.1.6.2 yamt if (nvp != NULL) {
180 1.1.1.1.6.2 yamt *npp = VTONFS(nvp);
181 1.1.1.1.6.2 yamt /* vfs_hash_insert() vput()'s the losing vnode */
182 1.1.1.1.6.2 yamt return (0);
183 1.1.1.1.6.2 yamt }
184 1.1.1.1.6.2 yamt *npp = np;
185 1.1.1.1.6.2 yamt
186 1.1.1.1.6.2 yamt return (0);
187 1.1.1.1.6.2 yamt }
188 1.1.1.1.6.2 yamt
189 1.1.1.1.6.2 yamt /*
190 1.1.1.1.6.2 yamt * Do the vrele(sp->s_dvp) as a separate task in order to avoid a
191 1.1.1.1.6.2 yamt * deadlock because of a LOR when vrele() locks the directory vnode.
192 1.1.1.1.6.2 yamt */
193 1.1.1.1.6.2 yamt static void
194 1.1.1.1.6.2 yamt nfs_freesillyrename(void *arg, __unused int pending)
195 1.1.1.1.6.2 yamt {
196 1.1.1.1.6.2 yamt struct sillyrename *sp;
197 1.1.1.1.6.2 yamt
198 1.1.1.1.6.2 yamt sp = arg;
199 1.1.1.1.6.2 yamt vrele(sp->s_dvp);
200 1.1.1.1.6.2 yamt free(sp, M_NEWNFSREQ);
201 1.1.1.1.6.2 yamt }
202 1.1.1.1.6.2 yamt
203 1.1.1.1.6.2 yamt int
204 1.1.1.1.6.2 yamt ncl_inactive(struct vop_inactive_args *ap)
205 1.1.1.1.6.2 yamt {
206 1.1.1.1.6.2 yamt struct nfsnode *np;
207 1.1.1.1.6.2 yamt struct sillyrename *sp;
208 1.1.1.1.6.2 yamt struct vnode *vp = ap->a_vp;
209 1.1.1.1.6.2 yamt boolean_t retv;
210 1.1.1.1.6.2 yamt
211 1.1.1.1.6.2 yamt np = VTONFS(vp);
212 1.1.1.1.6.2 yamt
213 1.1.1.1.6.2 yamt if (NFS_ISV4(vp) && vp->v_type == VREG) {
214 1.1.1.1.6.2 yamt /*
215 1.1.1.1.6.2 yamt * Since mmap()'d files do I/O after VOP_CLOSE(), the NFSv4
216 1.1.1.1.6.2 yamt * Close operations are delayed until now. Any dirty
217 1.1.1.1.6.2 yamt * buffers/pages must be flushed before the close, so that the
218 1.1.1.1.6.2 yamt * stateid is available for the writes.
219 1.1.1.1.6.2 yamt */
220 1.1.1.1.6.2 yamt if (vp->v_object != NULL) {
221 1.1.1.1.6.2 yamt VM_OBJECT_WLOCK(vp->v_object);
222 1.1.1.1.6.2 yamt retv = vm_object_page_clean(vp->v_object, 0, 0,
223 1.1.1.1.6.2 yamt OBJPC_SYNC);
224 1.1.1.1.6.2 yamt VM_OBJECT_WUNLOCK(vp->v_object);
225 1.1.1.1.6.2 yamt } else
226 1.1.1.1.6.2 yamt retv = TRUE;
227 1.1.1.1.6.2 yamt if (retv == TRUE) {
228 1.1.1.1.6.2 yamt (void)ncl_flush(vp, MNT_WAIT, NULL, ap->a_td, 1, 0);
229 1.1.1.1.6.2 yamt (void)nfsrpc_close(vp, 1, ap->a_td);
230 1.1.1.1.6.2 yamt }
231 1.1.1.1.6.2 yamt }
232 1.1.1.1.6.2 yamt
233 1.1.1.1.6.2 yamt mtx_lock(&np->n_mtx);
234 1.1.1.1.6.2 yamt if (vp->v_type != VDIR) {
235 1.1.1.1.6.2 yamt sp = np->n_sillyrename;
236 1.1.1.1.6.2 yamt np->n_sillyrename = NULL;
237 1.1.1.1.6.2 yamt } else
238 1.1.1.1.6.2 yamt sp = NULL;
239 1.1.1.1.6.2 yamt if (sp) {
240 1.1.1.1.6.2 yamt mtx_unlock(&np->n_mtx);
241 1.1.1.1.6.2 yamt (void) ncl_vinvalbuf(vp, 0, ap->a_td, 1);
242 1.1.1.1.6.2 yamt /*
243 1.1.1.1.6.2 yamt * Remove the silly file that was rename'd earlier
244 1.1.1.1.6.2 yamt */
245 1.1.1.1.6.2 yamt ncl_removeit(sp, vp);
246 1.1.1.1.6.2 yamt crfree(sp->s_cred);
247 1.1.1.1.6.2 yamt TASK_INIT(&sp->s_task, 0, nfs_freesillyrename, sp);
248 1.1.1.1.6.2 yamt taskqueue_enqueue(taskqueue_thread, &sp->s_task);
249 1.1.1.1.6.2 yamt mtx_lock(&np->n_mtx);
250 1.1.1.1.6.2 yamt }
251 1.1.1.1.6.2 yamt np->n_flag &= NMODIFIED;
252 1.1.1.1.6.2 yamt mtx_unlock(&np->n_mtx);
253 1.1.1.1.6.2 yamt return (0);
254 1.1.1.1.6.2 yamt }
255 1.1.1.1.6.2 yamt
256 1.1.1.1.6.2 yamt /*
257 1.1.1.1.6.2 yamt * Reclaim an nfsnode so that it can be used for other purposes.
258 1.1.1.1.6.2 yamt */
259 1.1.1.1.6.2 yamt int
260 1.1.1.1.6.2 yamt ncl_reclaim(struct vop_reclaim_args *ap)
261 1.1.1.1.6.2 yamt {
262 1.1.1.1.6.2 yamt struct vnode *vp = ap->a_vp;
263 1.1.1.1.6.2 yamt struct nfsnode *np = VTONFS(vp);
264 1.1.1.1.6.2 yamt struct nfsdmap *dp, *dp2;
265 1.1.1.1.6.2 yamt
266 1.1.1.1.6.2 yamt /*
267 1.1.1.1.6.2 yamt * If the NLM is running, give it a chance to abort pending
268 1.1.1.1.6.2 yamt * locks.
269 1.1.1.1.6.2 yamt */
270 1.1.1.1.6.2 yamt if (nfs_reclaim_p != NULL)
271 1.1.1.1.6.2 yamt nfs_reclaim_p(ap);
272 1.1.1.1.6.2 yamt
273 1.1.1.1.6.2 yamt /*
274 1.1.1.1.6.2 yamt * Destroy the vm object and flush associated pages.
275 1.1.1.1.6.2 yamt */
276 1.1.1.1.6.2 yamt vnode_destroy_vobject(vp);
277 1.1.1.1.6.2 yamt
278 1.1.1.1.6.2 yamt if (NFS_ISV4(vp) && vp->v_type == VREG)
279 1.1.1.1.6.2 yamt /*
280 1.1.1.1.6.2 yamt * We can now safely close any remaining NFSv4 Opens for
281 1.1.1.1.6.2 yamt * this file. Most opens will have already been closed by
282 1.1.1.1.6.2 yamt * ncl_inactive(), but there are cases where it is not
283 1.1.1.1.6.2 yamt * called, so we need to do it again here.
284 1.1.1.1.6.2 yamt */
285 1.1.1.1.6.2 yamt (void) nfsrpc_close(vp, 1, ap->a_td);
286 1.1.1.1.6.2 yamt
287 1.1.1.1.6.2 yamt vfs_hash_remove(vp);
288 1.1.1.1.6.2 yamt
289 1.1.1.1.6.2 yamt /*
290 1.1.1.1.6.2 yamt * Call nfscl_reclaimnode() to save attributes in the delegation,
291 1.1.1.1.6.2 yamt * as required.
292 1.1.1.1.6.2 yamt */
293 1.1.1.1.6.2 yamt if (vp->v_type == VREG)
294 1.1.1.1.6.2 yamt nfscl_reclaimnode(vp);
295 1.1.1.1.6.2 yamt
296 1.1.1.1.6.2 yamt /*
297 1.1.1.1.6.2 yamt * Free up any directory cookie structures and
298 1.1.1.1.6.2 yamt * large file handle structures that might be associated with
299 1.1.1.1.6.2 yamt * this nfs node.
300 1.1.1.1.6.2 yamt */
301 1.1.1.1.6.2 yamt if (vp->v_type == VDIR) {
302 1.1.1.1.6.2 yamt dp = LIST_FIRST(&np->n_cookies);
303 1.1.1.1.6.2 yamt while (dp) {
304 1.1.1.1.6.2 yamt dp2 = dp;
305 1.1.1.1.6.2 yamt dp = LIST_NEXT(dp, ndm_list);
306 1.1.1.1.6.2 yamt FREE((caddr_t)dp2, M_NFSDIROFF);
307 1.1.1.1.6.2 yamt }
308 1.1.1.1.6.2 yamt }
309 1.1.1.1.6.2 yamt if (np->n_writecred != NULL)
310 1.1.1.1.6.2 yamt crfree(np->n_writecred);
311 1.1.1.1.6.2 yamt FREE((caddr_t)np->n_fhp, M_NFSFH);
312 1.1.1.1.6.2 yamt if (np->n_v4 != NULL)
313 1.1.1.1.6.2 yamt FREE((caddr_t)np->n_v4, M_NFSV4NODE);
314 1.1.1.1.6.2 yamt mtx_destroy(&np->n_mtx);
315 1.1.1.1.6.2 yamt uma_zfree(newnfsnode_zone, vp->v_data);
316 1.1.1.1.6.2 yamt vp->v_data = NULL;
317 1.1.1.1.6.2 yamt return (0);
318 1.1.1.1.6.2 yamt }
319 1.1.1.1.6.2 yamt
320 1.1.1.1.6.2 yamt /*
321 1.1.1.1.6.2 yamt * Invalidate both the access and attribute caches for this vnode.
322 1.1.1.1.6.2 yamt */
323 1.1.1.1.6.2 yamt void
324 1.1.1.1.6.2 yamt ncl_invalcaches(struct vnode *vp)
325 1.1.1.1.6.2 yamt {
326 1.1.1.1.6.2 yamt struct nfsnode *np = VTONFS(vp);
327 1.1.1.1.6.2 yamt int i;
328 1.1.1.1.6.2 yamt
329 1.1.1.1.6.2 yamt mtx_lock(&np->n_mtx);
330 1.1.1.1.6.2 yamt for (i = 0; i < NFS_ACCESSCACHESIZE; i++)
331 1.1.1.1.6.2 yamt np->n_accesscache[i].stamp = 0;
332 1.1.1.1.6.2 yamt KDTRACE_NFS_ACCESSCACHE_FLUSH_DONE(vp);
333 1.1.1.1.6.2 yamt np->n_attrstamp = 0;
334 1.1.1.1.6.2 yamt KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp);
335 1.1.1.1.6.2 yamt mtx_unlock(&np->n_mtx);
336 1.1.1.1.6.2 yamt }
337 1.1.1.1.6.2 yamt
338