nfs_iod.c revision 1.6 1 1.6 martin /* $NetBSD: nfs_iod.c,v 1.6 2013/10/25 16:01:56 martin Exp $ */
2 1.1 ad
3 1.1 ad /*
4 1.1 ad * Copyright (c) 1989, 1993
5 1.1 ad * The Regents of the University of California. All rights reserved.
6 1.1 ad *
7 1.1 ad * This code is derived from software contributed to Berkeley by
8 1.1 ad * Rick Macklem at The University of Guelph.
9 1.1 ad *
10 1.1 ad * Redistribution and use in source and binary forms, with or without
11 1.1 ad * modification, are permitted provided that the following conditions
12 1.1 ad * are met:
13 1.1 ad * 1. Redistributions of source code must retain the above copyright
14 1.1 ad * notice, this list of conditions and the following disclaimer.
15 1.1 ad * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 ad * notice, this list of conditions and the following disclaimer in the
17 1.1 ad * documentation and/or other materials provided with the distribution.
18 1.1 ad * 3. Neither the name of the University nor the names of its contributors
19 1.1 ad * may be used to endorse or promote products derived from this software
20 1.1 ad * without specific prior written permission.
21 1.1 ad *
22 1.1 ad * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 1.1 ad * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 1.1 ad * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 1.1 ad * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 1.1 ad * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 1.1 ad * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 1.1 ad * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 1.1 ad * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 1.1 ad * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 1.1 ad * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 1.1 ad * SUCH DAMAGE.
33 1.1 ad *
34 1.1 ad * @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95
35 1.1 ad */
36 1.1 ad
37 1.1 ad #include <sys/cdefs.h>
38 1.6 martin __KERNEL_RCSID(0, "$NetBSD: nfs_iod.c,v 1.6 2013/10/25 16:01:56 martin Exp $");
39 1.1 ad
40 1.1 ad #include <sys/param.h>
41 1.1 ad #include <sys/systm.h>
42 1.1 ad #include <sys/kernel.h>
43 1.1 ad #include <sys/file.h>
44 1.1 ad #include <sys/stat.h>
45 1.1 ad #include <sys/vnode.h>
46 1.1 ad #include <sys/mount.h>
47 1.1 ad #include <sys/proc.h>
48 1.1 ad #include <sys/uio.h>
49 1.1 ad #include <sys/malloc.h>
50 1.1 ad #include <sys/kmem.h>
51 1.1 ad #include <sys/buf.h>
52 1.1 ad #include <sys/mbuf.h>
53 1.1 ad #include <sys/socket.h>
54 1.1 ad #include <sys/socketvar.h>
55 1.1 ad #include <sys/signalvar.h>
56 1.1 ad #include <sys/domain.h>
57 1.1 ad #include <sys/protosw.h>
58 1.1 ad #include <sys/namei.h>
59 1.1 ad #include <sys/syslog.h>
60 1.1 ad #include <sys/filedesc.h>
61 1.1 ad #include <sys/kthread.h>
62 1.1 ad #include <sys/kauth.h>
63 1.1 ad #include <sys/syscallargs.h>
64 1.1 ad
65 1.1 ad #include <netinet/in.h>
66 1.1 ad #include <netinet/tcp.h>
67 1.1 ad #include <nfs/xdr_subs.h>
68 1.1 ad #include <nfs/rpcv2.h>
69 1.1 ad #include <nfs/nfsproto.h>
70 1.1 ad #include <nfs/nfs.h>
71 1.1 ad #include <nfs/nfsm_subs.h>
72 1.1 ad #include <nfs/nfsrvcache.h>
73 1.1 ad #include <nfs/nfsmount.h>
74 1.1 ad #include <nfs/nfsnode.h>
75 1.1 ad #include <nfs/nfsrtt.h>
76 1.1 ad #include <nfs/nfs_var.h>
77 1.1 ad
78 1.4 christos extern int nuidhash_max;
79 1.1 ad
80 1.1 ad /*
81 1.1 ad * locking order:
82 1.1 ad * nfs_iodlist_lock -> nid_lock -> nm_lock
83 1.1 ad */
84 1.1 ad kmutex_t nfs_iodlist_lock;
85 1.1 ad struct nfs_iodlist nfs_iodlist_idle;
86 1.1 ad struct nfs_iodlist nfs_iodlist_all;
87 1.1 ad int nfs_niothreads = -1; /* == "0, and has never been set" */
88 1.1 ad int nfs_defect = 0;
89 1.1 ad
90 1.1 ad /*
91 1.1 ad * Asynchronous I/O threads for client nfs.
92 1.1 ad * They do read-ahead and write-behind operations on the block I/O cache.
93 1.1 ad * Never returns unless it fails or gets killed.
94 1.1 ad */
95 1.1 ad
96 1.1 ad static void
97 1.1 ad nfssvc_iod(void *arg)
98 1.1 ad {
99 1.1 ad struct buf *bp;
100 1.1 ad struct nfs_iod *myiod;
101 1.1 ad struct nfsmount *nmp;
102 1.1 ad
103 1.1 ad myiod = kmem_alloc(sizeof(*myiod), KM_SLEEP);
104 1.1 ad mutex_init(&myiod->nid_lock, MUTEX_DEFAULT, IPL_NONE);
105 1.1 ad cv_init(&myiod->nid_cv, "nfsiod");
106 1.1 ad myiod->nid_exiting = false;
107 1.1 ad myiod->nid_mount = NULL;
108 1.1 ad mutex_enter(&nfs_iodlist_lock);
109 1.1 ad LIST_INSERT_HEAD(&nfs_iodlist_all, myiod, nid_all);
110 1.1 ad mutex_exit(&nfs_iodlist_lock);
111 1.1 ad
112 1.1 ad for (;;) {
113 1.1 ad mutex_enter(&nfs_iodlist_lock);
114 1.1 ad LIST_INSERT_HEAD(&nfs_iodlist_idle, myiod, nid_idle);
115 1.1 ad mutex_exit(&nfs_iodlist_lock);
116 1.1 ad
117 1.1 ad mutex_enter(&myiod->nid_lock);
118 1.1 ad while (/*CONSTCOND*/ true) {
119 1.1 ad nmp = myiod->nid_mount;
120 1.1 ad if (nmp) {
121 1.1 ad myiod->nid_mount = NULL;
122 1.1 ad break;
123 1.1 ad }
124 1.1 ad if (__predict_false(myiod->nid_exiting)) {
125 1.1 ad /*
126 1.1 ad * drop nid_lock to preserve locking order.
127 1.1 ad */
128 1.1 ad mutex_exit(&myiod->nid_lock);
129 1.1 ad mutex_enter(&nfs_iodlist_lock);
130 1.1 ad mutex_enter(&myiod->nid_lock);
131 1.1 ad /*
132 1.1 ad * recheck nid_mount because nfs_asyncio can
133 1.1 ad * pick us in the meantime as we are still on
134 1.1 ad * nfs_iodlist_lock.
135 1.1 ad */
136 1.1 ad if (myiod->nid_mount != NULL) {
137 1.1 ad mutex_exit(&nfs_iodlist_lock);
138 1.1 ad continue;
139 1.1 ad }
140 1.1 ad LIST_REMOVE(myiod, nid_idle);
141 1.1 ad mutex_exit(&nfs_iodlist_lock);
142 1.1 ad goto quit;
143 1.1 ad }
144 1.1 ad cv_wait(&myiod->nid_cv, &myiod->nid_lock);
145 1.1 ad }
146 1.1 ad mutex_exit(&myiod->nid_lock);
147 1.1 ad
148 1.1 ad mutex_enter(&nmp->nm_lock);
149 1.1 ad while ((bp = TAILQ_FIRST(&nmp->nm_bufq)) != NULL) {
150 1.1 ad /* Take one off the front of the list */
151 1.1 ad TAILQ_REMOVE(&nmp->nm_bufq, bp, b_freelist);
152 1.1 ad nmp->nm_bufqlen--;
153 1.1 ad if (nmp->nm_bufqlen < 2 * nmp->nm_bufqiods) {
154 1.1 ad cv_broadcast(&nmp->nm_aiocv);
155 1.1 ad }
156 1.1 ad mutex_exit(&nmp->nm_lock);
157 1.1 ad KERNEL_LOCK(1, curlwp);
158 1.1 ad (void)nfs_doio(bp);
159 1.1 ad KERNEL_UNLOCK_LAST(curlwp);
160 1.1 ad mutex_enter(&nmp->nm_lock);
161 1.1 ad /*
162 1.1 ad * If there are more than one iod on this mount,
163 1.1 ad * then defect so that the iods can be shared out
164 1.1 ad * fairly between the mounts
165 1.1 ad */
166 1.1 ad if (nfs_defect && nmp->nm_bufqiods > 1) {
167 1.1 ad break;
168 1.1 ad }
169 1.1 ad }
170 1.1 ad KASSERT(nmp->nm_bufqiods > 0);
171 1.1 ad nmp->nm_bufqiods--;
172 1.1 ad mutex_exit(&nmp->nm_lock);
173 1.1 ad }
174 1.1 ad quit:
175 1.1 ad KASSERT(myiod->nid_mount == NULL);
176 1.1 ad mutex_exit(&myiod->nid_lock);
177 1.1 ad
178 1.1 ad cv_destroy(&myiod->nid_cv);
179 1.1 ad mutex_destroy(&myiod->nid_lock);
180 1.1 ad kmem_free(myiod, sizeof(*myiod));
181 1.1 ad
182 1.1 ad kthread_exit(0);
183 1.1 ad }
184 1.1 ad
185 1.1 ad void
186 1.1 ad nfs_iodinit(void)
187 1.1 ad {
188 1.1 ad
189 1.1 ad mutex_init(&nfs_iodlist_lock, MUTEX_DEFAULT, IPL_NONE);
190 1.1 ad LIST_INIT(&nfs_iodlist_all);
191 1.1 ad LIST_INIT(&nfs_iodlist_idle);
192 1.1 ad }
193 1.1 ad
194 1.1 ad void
195 1.1 ad nfs_iodfini(void)
196 1.1 ad {
197 1.6 martin int error __diagused;
198 1.1 ad
199 1.1 ad error = nfs_set_niothreads(0);
200 1.1 ad KASSERT(error == 0);
201 1.1 ad mutex_destroy(&nfs_iodlist_lock);
202 1.1 ad }
203 1.1 ad
204 1.1 ad int
205 1.1 ad nfs_set_niothreads(int newval)
206 1.1 ad {
207 1.1 ad struct nfs_iod *nid;
208 1.1 ad int error = 0;
209 1.1 ad int hold_count;
210 1.1 ad
211 1.1 ad KERNEL_UNLOCK_ALL(curlwp, &hold_count);
212 1.1 ad
213 1.1 ad mutex_enter(&nfs_iodlist_lock);
214 1.1 ad /* clamp to sane range */
215 1.1 ad nfs_niothreads = max(0, min(newval, NFS_MAXASYNCDAEMON));
216 1.1 ad
217 1.1 ad while (nfs_numasync != nfs_niothreads && error == 0) {
218 1.1 ad while (nfs_numasync < nfs_niothreads) {
219 1.1 ad
220 1.1 ad /*
221 1.1 ad * kthread_create can wait for pagedaemon and
222 1.1 ad * pagedaemon can wait for nfsiod which needs to acquire
223 1.1 ad * nfs_iodlist_lock.
224 1.1 ad */
225 1.1 ad
226 1.1 ad mutex_exit(&nfs_iodlist_lock);
227 1.1 ad error = kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL,
228 1.1 ad nfssvc_iod, NULL, NULL, "nfsio");
229 1.1 ad mutex_enter(&nfs_iodlist_lock);
230 1.1 ad if (error) {
231 1.1 ad /* give up */
232 1.1 ad nfs_niothreads = nfs_numasync;
233 1.1 ad break;
234 1.1 ad }
235 1.1 ad nfs_numasync++;
236 1.1 ad }
237 1.1 ad while (nfs_numasync > nfs_niothreads) {
238 1.1 ad nid = LIST_FIRST(&nfs_iodlist_all);
239 1.1 ad if (nid == NULL) {
240 1.1 ad /* iod has not started yet. */
241 1.1 ad kpause("nfsiorm", false, hz, &nfs_iodlist_lock);
242 1.1 ad continue;
243 1.1 ad }
244 1.1 ad LIST_REMOVE(nid, nid_all);
245 1.1 ad mutex_enter(&nid->nid_lock);
246 1.1 ad KASSERT(!nid->nid_exiting);
247 1.1 ad nid->nid_exiting = true;
248 1.1 ad cv_signal(&nid->nid_cv);
249 1.1 ad mutex_exit(&nid->nid_lock);
250 1.1 ad nfs_numasync--;
251 1.1 ad }
252 1.1 ad }
253 1.1 ad mutex_exit(&nfs_iodlist_lock);
254 1.1 ad
255 1.1 ad KERNEL_LOCK(hold_count, curlwp);
256 1.1 ad return error;
257 1.1 ad }
258 1.1 ad
259 1.1 ad /*
260 1.1 ad * Get an authorization string for the uid by having the mount_nfs sitting
261 1.1 ad * on this mount point porpous out of the kernel and do it.
262 1.1 ad */
263 1.1 ad int
264 1.3 dsl nfs_getauth(struct nfsmount *nmp, struct nfsreq *rep, kauth_cred_t cred, char **auth_str, int *auth_len, char *verf_str, int *verf_len, NFSKERBKEY_T key)
265 1.3 dsl /* key: return session key */
266 1.1 ad {
267 1.1 ad int error = 0;
268 1.1 ad
269 1.1 ad while ((nmp->nm_iflag & NFSMNT_WAITAUTH) == 0) {
270 1.1 ad nmp->nm_iflag |= NFSMNT_WANTAUTH;
271 1.1 ad (void) tsleep((void *)&nmp->nm_authtype, PSOCK,
272 1.1 ad "nfsauth1", 2 * hz);
273 1.1 ad error = nfs_sigintr(nmp, rep, rep->r_lwp);
274 1.1 ad if (error) {
275 1.1 ad nmp->nm_iflag &= ~NFSMNT_WANTAUTH;
276 1.1 ad return (error);
277 1.1 ad }
278 1.1 ad }
279 1.1 ad nmp->nm_iflag &= ~(NFSMNT_WAITAUTH | NFSMNT_WANTAUTH);
280 1.1 ad nmp->nm_authstr = *auth_str = (char *)malloc(RPCAUTH_MAXSIZ, M_TEMP, M_WAITOK);
281 1.1 ad nmp->nm_authlen = RPCAUTH_MAXSIZ;
282 1.1 ad nmp->nm_verfstr = verf_str;
283 1.1 ad nmp->nm_verflen = *verf_len;
284 1.1 ad nmp->nm_authuid = kauth_cred_geteuid(cred);
285 1.1 ad wakeup((void *)&nmp->nm_authstr);
286 1.1 ad
287 1.1 ad /*
288 1.1 ad * And wait for mount_nfs to do its stuff.
289 1.1 ad */
290 1.1 ad while ((nmp->nm_iflag & NFSMNT_HASAUTH) == 0 && error == 0) {
291 1.1 ad (void) tsleep((void *)&nmp->nm_authlen, PSOCK,
292 1.1 ad "nfsauth2", 2 * hz);
293 1.1 ad error = nfs_sigintr(nmp, rep, rep->r_lwp);
294 1.1 ad }
295 1.1 ad if (nmp->nm_iflag & NFSMNT_AUTHERR) {
296 1.1 ad nmp->nm_iflag &= ~NFSMNT_AUTHERR;
297 1.1 ad error = EAUTH;
298 1.1 ad }
299 1.1 ad if (error)
300 1.1 ad free((void *)*auth_str, M_TEMP);
301 1.1 ad else {
302 1.1 ad *auth_len = nmp->nm_authlen;
303 1.1 ad *verf_len = nmp->nm_verflen;
304 1.1 ad memcpy(key, nmp->nm_key, sizeof (NFSKERBKEY_T));
305 1.1 ad }
306 1.1 ad nmp->nm_iflag &= ~NFSMNT_HASAUTH;
307 1.1 ad nmp->nm_iflag |= NFSMNT_WAITAUTH;
308 1.1 ad if (nmp->nm_iflag & NFSMNT_WANTAUTH) {
309 1.1 ad nmp->nm_iflag &= ~NFSMNT_WANTAUTH;
310 1.1 ad wakeup((void *)&nmp->nm_authtype);
311 1.1 ad }
312 1.1 ad return (error);
313 1.1 ad }
314 1.1 ad
315 1.1 ad /*
316 1.1 ad * Get a nickname authenticator and verifier.
317 1.1 ad */
318 1.1 ad int
319 1.1 ad nfs_getnickauth(struct nfsmount *nmp, kauth_cred_t cred, char **auth_str,
320 1.1 ad int *auth_len, char *verf_str, int verf_len)
321 1.1 ad {
322 1.5 martin #ifdef NFSKERB
323 1.5 martin struct timeval ktvin;
324 1.5 martin #endif
325 1.5 martin struct timeval ktvout, tv;
326 1.1 ad struct nfsuid *nuidp;
327 1.1 ad u_int32_t *nickp, *verfp;
328 1.1 ad
329 1.1 ad memset(&ktvout, 0, sizeof ktvout); /* XXX gcc */
330 1.1 ad
331 1.1 ad #ifdef DIAGNOSTIC
332 1.1 ad if (verf_len < (4 * NFSX_UNSIGNED))
333 1.1 ad panic("nfs_getnickauth verf too small");
334 1.1 ad #endif
335 1.1 ad LIST_FOREACH(nuidp, NMUIDHASH(nmp, kauth_cred_geteuid(cred)), nu_hash) {
336 1.1 ad if (kauth_cred_geteuid(nuidp->nu_cr) == kauth_cred_geteuid(cred))
337 1.1 ad break;
338 1.1 ad }
339 1.1 ad if (!nuidp || nuidp->nu_expire < time_second)
340 1.1 ad return (EACCES);
341 1.1 ad
342 1.1 ad /*
343 1.1 ad * Move to the end of the lru list (end of lru == most recently used).
344 1.1 ad */
345 1.1 ad TAILQ_REMOVE(&nmp->nm_uidlruhead, nuidp, nu_lru);
346 1.1 ad TAILQ_INSERT_TAIL(&nmp->nm_uidlruhead, nuidp, nu_lru);
347 1.1 ad
348 1.1 ad nickp = (u_int32_t *)malloc(2 * NFSX_UNSIGNED, M_TEMP, M_WAITOK);
349 1.1 ad *nickp++ = txdr_unsigned(RPCAKN_NICKNAME);
350 1.1 ad *nickp = txdr_unsigned(nuidp->nu_nickname);
351 1.1 ad *auth_str = (char *)nickp;
352 1.1 ad *auth_len = 2 * NFSX_UNSIGNED;
353 1.1 ad
354 1.1 ad /*
355 1.1 ad * Now we must encrypt the verifier and package it up.
356 1.1 ad */
357 1.1 ad verfp = (u_int32_t *)verf_str;
358 1.1 ad *verfp++ = txdr_unsigned(RPCAKN_NICKNAME);
359 1.1 ad getmicrotime(&tv);
360 1.1 ad if (tv.tv_sec > nuidp->nu_timestamp.tv_sec ||
361 1.1 ad (tv.tv_sec == nuidp->nu_timestamp.tv_sec &&
362 1.1 ad tv.tv_usec > nuidp->nu_timestamp.tv_usec))
363 1.1 ad nuidp->nu_timestamp = tv;
364 1.1 ad else
365 1.1 ad nuidp->nu_timestamp.tv_usec++;
366 1.5 martin #ifdef NFSKERB
367 1.1 ad ktvin.tv_sec = txdr_unsigned(nuidp->nu_timestamp.tv_sec);
368 1.1 ad ktvin.tv_usec = txdr_unsigned(nuidp->nu_timestamp.tv_usec);
369 1.1 ad
370 1.1 ad /*
371 1.1 ad * Now encrypt the timestamp verifier in ecb mode using the session
372 1.1 ad * key.
373 1.1 ad */
374 1.1 ad XXX
375 1.1 ad #endif
376 1.1 ad
377 1.1 ad *verfp++ = ktvout.tv_sec;
378 1.1 ad *verfp++ = ktvout.tv_usec;
379 1.1 ad *verfp = 0;
380 1.1 ad return (0);
381 1.1 ad }
382 1.1 ad
383 1.1 ad /*
384 1.1 ad * Save the current nickname in a hash list entry on the mount point.
385 1.1 ad */
386 1.1 ad int
387 1.2 dsl nfs_savenickauth(struct nfsmount *nmp, kauth_cred_t cred, int len, NFSKERBKEY_T key, struct mbuf **mdp, char **dposp, struct mbuf *mrep)
388 1.1 ad {
389 1.1 ad struct nfsuid *nuidp;
390 1.1 ad u_int32_t *tl;
391 1.1 ad int32_t t1;
392 1.1 ad struct mbuf *md = *mdp;
393 1.1 ad struct timeval ktvin, ktvout;
394 1.1 ad u_int32_t nick;
395 1.1 ad char *dpos = *dposp, *cp2;
396 1.1 ad int deltasec, error = 0;
397 1.1 ad
398 1.1 ad memset(&ktvout, 0, sizeof ktvout); /* XXX gcc */
399 1.1 ad
400 1.1 ad if (len == (3 * NFSX_UNSIGNED)) {
401 1.1 ad nfsm_dissect(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
402 1.1 ad ktvin.tv_sec = *tl++;
403 1.1 ad ktvin.tv_usec = *tl++;
404 1.1 ad nick = fxdr_unsigned(u_int32_t, *tl);
405 1.1 ad
406 1.1 ad /*
407 1.1 ad * Decrypt the timestamp in ecb mode.
408 1.1 ad */
409 1.1 ad #ifdef NFSKERB
410 1.1 ad XXX
411 1.5 martin #else
412 1.5 martin (void)ktvin.tv_sec;
413 1.1 ad #endif
414 1.1 ad ktvout.tv_sec = fxdr_unsigned(long, ktvout.tv_sec);
415 1.1 ad ktvout.tv_usec = fxdr_unsigned(long, ktvout.tv_usec);
416 1.1 ad deltasec = time_second - ktvout.tv_sec;
417 1.1 ad if (deltasec < 0)
418 1.1 ad deltasec = -deltasec;
419 1.1 ad /*
420 1.1 ad * If ok, add it to the hash list for the mount point.
421 1.1 ad */
422 1.1 ad if (deltasec <= NFS_KERBCLOCKSKEW) {
423 1.1 ad if (nmp->nm_numuids < nuidhash_max) {
424 1.1 ad nmp->nm_numuids++;
425 1.1 ad nuidp = kmem_alloc(sizeof(*nuidp), KM_SLEEP);
426 1.1 ad } else {
427 1.1 ad nuidp = TAILQ_FIRST(&nmp->nm_uidlruhead);
428 1.1 ad LIST_REMOVE(nuidp, nu_hash);
429 1.1 ad TAILQ_REMOVE(&nmp->nm_uidlruhead, nuidp,
430 1.1 ad nu_lru);
431 1.1 ad }
432 1.1 ad nuidp->nu_flag = 0;
433 1.1 ad kauth_cred_seteuid(nuidp->nu_cr, kauth_cred_geteuid(cred));
434 1.1 ad nuidp->nu_expire = time_second + NFS_KERBTTL;
435 1.1 ad nuidp->nu_timestamp = ktvout;
436 1.1 ad nuidp->nu_nickname = nick;
437 1.1 ad memcpy(nuidp->nu_key, key, sizeof (NFSKERBKEY_T));
438 1.1 ad TAILQ_INSERT_TAIL(&nmp->nm_uidlruhead, nuidp,
439 1.1 ad nu_lru);
440 1.1 ad LIST_INSERT_HEAD(NMUIDHASH(nmp, kauth_cred_geteuid(cred)),
441 1.1 ad nuidp, nu_hash);
442 1.1 ad }
443 1.1 ad } else
444 1.1 ad nfsm_adv(nfsm_rndup(len));
445 1.1 ad nfsmout:
446 1.1 ad *mdp = md;
447 1.1 ad *dposp = dpos;
448 1.1 ad return (error);
449 1.1 ad }
450