nfs_clnfsiod.c revision 1.1.1.1.10.3 1 1.1.1.1.10.2 tls /* $NetBSD: nfs_clnfsiod.c,v 1.1.1.1.10.3 2017/12/03 11:38:42 jdolecek Exp $ */
2 1.1.1.1.10.2 tls /*-
3 1.1.1.1.10.2 tls * Copyright (c) 1989, 1993
4 1.1.1.1.10.2 tls * The Regents of the University of California. All rights reserved.
5 1.1.1.1.10.2 tls *
6 1.1.1.1.10.2 tls * This code is derived from software contributed to Berkeley by
7 1.1.1.1.10.2 tls * Rick Macklem at The University of Guelph.
8 1.1.1.1.10.2 tls *
9 1.1.1.1.10.2 tls * Redistribution and use in source and binary forms, with or without
10 1.1.1.1.10.2 tls * modification, are permitted provided that the following conditions
11 1.1.1.1.10.2 tls * are met:
12 1.1.1.1.10.2 tls * 1. Redistributions of source code must retain the above copyright
13 1.1.1.1.10.2 tls * notice, this list of conditions and the following disclaimer.
14 1.1.1.1.10.2 tls * 2. Redistributions in binary form must reproduce the above copyright
15 1.1.1.1.10.2 tls * notice, this list of conditions and the following disclaimer in the
16 1.1.1.1.10.2 tls * documentation and/or other materials provided with the distribution.
17 1.1.1.1.10.2 tls * 4. Neither the name of the University nor the names of its contributors
18 1.1.1.1.10.2 tls * may be used to endorse or promote products derived from this software
19 1.1.1.1.10.2 tls * without specific prior written permission.
20 1.1.1.1.10.2 tls *
21 1.1.1.1.10.2 tls * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 1.1.1.1.10.2 tls * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 1.1.1.1.10.2 tls * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 1.1.1.1.10.2 tls * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 1.1.1.1.10.2 tls * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 1.1.1.1.10.2 tls * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 1.1.1.1.10.2 tls * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 1.1.1.1.10.2 tls * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 1.1.1.1.10.2 tls * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 1.1.1.1.10.2 tls * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 1.1.1.1.10.2 tls * SUCH DAMAGE.
32 1.1.1.1.10.2 tls *
33 1.1.1.1.10.2 tls * from nfs_syscalls.c 8.5 (Berkeley) 3/30/95
34 1.1.1.1.10.2 tls */
35 1.1.1.1.10.2 tls
36 1.1.1.1.10.2 tls #include <sys/cdefs.h>
37 1.1.1.1.10.2 tls /* __FBSDID("FreeBSD: head/sys/fs/nfsclient/nfs_clnfsiod.c 249630 2013-04-18 23:20:16Z rmacklem "); */
38 1.1.1.1.10.2 tls __RCSID("$NetBSD: nfs_clnfsiod.c,v 1.1.1.1.10.3 2017/12/03 11:38:42 jdolecek Exp $");
39 1.1.1.1.10.2 tls
40 1.1.1.1.10.2 tls #include <sys/param.h>
41 1.1.1.1.10.2 tls #include <sys/systm.h>
42 1.1.1.1.10.2 tls #include <sys/sysproto.h>
43 1.1.1.1.10.2 tls #include <sys/kernel.h>
44 1.1.1.1.10.2 tls #include <sys/sysctl.h>
45 1.1.1.1.10.2 tls #include <sys/file.h>
46 1.1.1.1.10.2 tls #include <sys/filedesc.h>
47 1.1.1.1.10.2 tls #include <sys/vnode.h>
48 1.1.1.1.10.2 tls #include <sys/malloc.h>
49 1.1.1.1.10.2 tls #include <sys/mount.h>
50 1.1.1.1.10.2 tls #include <sys/proc.h>
51 1.1.1.1.10.2 tls #include <sys/bio.h>
52 1.1.1.1.10.2 tls #include <sys/buf.h>
53 1.1.1.1.10.2 tls #include <sys/mbuf.h>
54 1.1.1.1.10.2 tls #include <sys/socket.h>
55 1.1.1.1.10.2 tls #include <sys/socketvar.h>
56 1.1.1.1.10.2 tls #include <sys/domain.h>
57 1.1.1.1.10.2 tls #include <sys/protosw.h>
58 1.1.1.1.10.2 tls #include <sys/namei.h>
59 1.1.1.1.10.2 tls #include <sys/unistd.h>
60 1.1.1.1.10.2 tls #include <sys/kthread.h>
61 1.1.1.1.10.2 tls #include <sys/fcntl.h>
62 1.1.1.1.10.2 tls #include <sys/lockf.h>
63 1.1.1.1.10.2 tls #include <sys/mutex.h>
64 1.1.1.1.10.2 tls #include <sys/taskqueue.h>
65 1.1.1.1.10.2 tls
66 1.1.1.1.10.2 tls #include <netinet/in.h>
67 1.1.1.1.10.2 tls #include <netinet/tcp.h>
68 1.1.1.1.10.2 tls
69 1.1.1.1.10.3 jdolecek #include <fs/nfs/common/nfsport.h>
70 1.1.1.1.10.3 jdolecek #include <fs/nfs/client/nfsmount.h>
71 1.1.1.1.10.3 jdolecek #include <fs/nfs/client/nfs.h>
72 1.1.1.1.10.3 jdolecek #include <fs/nfs/client/nfsnode.h>
73 1.1.1.1.10.2 tls
74 1.1.1.1.10.2 tls extern struct mtx ncl_iod_mutex;
75 1.1.1.1.10.2 tls extern struct task ncl_nfsiodnew_task;
76 1.1.1.1.10.2 tls
77 1.1.1.1.10.2 tls int ncl_numasync;
78 1.1.1.1.10.2 tls enum nfsiod_state ncl_iodwant[NFS_MAXASYNCDAEMON];
79 1.1.1.1.10.2 tls struct nfsmount *ncl_iodmount[NFS_MAXASYNCDAEMON];
80 1.1.1.1.10.2 tls
81 1.1.1.1.10.2 tls static void nfssvc_iod(void *);
82 1.1.1.1.10.2 tls
83 1.1.1.1.10.2 tls static int nfs_asyncdaemon[NFS_MAXASYNCDAEMON];
84 1.1.1.1.10.2 tls
85 1.1.1.1.10.2 tls SYSCTL_DECL(_vfs_nfs);
86 1.1.1.1.10.2 tls
87 1.1.1.1.10.2 tls /* Maximum number of seconds a nfsiod kthread will sleep before exiting */
88 1.1.1.1.10.2 tls static unsigned int nfs_iodmaxidle = 120;
89 1.1.1.1.10.2 tls SYSCTL_UINT(_vfs_nfs, OID_AUTO, iodmaxidle, CTLFLAG_RW, &nfs_iodmaxidle, 0,
90 1.1.1.1.10.2 tls "Max number of seconds an nfsiod kthread will sleep before exiting");
91 1.1.1.1.10.2 tls
92 1.1.1.1.10.2 tls /* Maximum number of nfsiod kthreads */
93 1.1.1.1.10.2 tls unsigned int ncl_iodmax = 20;
94 1.1.1.1.10.2 tls
95 1.1.1.1.10.2 tls /* Minimum number of nfsiod kthreads to keep as spares */
96 1.1.1.1.10.2 tls static unsigned int nfs_iodmin = 0;
97 1.1.1.1.10.2 tls
98 1.1.1.1.10.2 tls static int nfs_nfsiodnew_sync(void);
99 1.1.1.1.10.2 tls
100 1.1.1.1.10.2 tls static int
101 1.1.1.1.10.2 tls sysctl_iodmin(SYSCTL_HANDLER_ARGS)
102 1.1.1.1.10.2 tls {
103 1.1.1.1.10.2 tls int error, i;
104 1.1.1.1.10.2 tls int newmin;
105 1.1.1.1.10.2 tls
106 1.1.1.1.10.2 tls newmin = nfs_iodmin;
107 1.1.1.1.10.2 tls error = sysctl_handle_int(oidp, &newmin, 0, req);
108 1.1.1.1.10.2 tls if (error || (req->newptr == NULL))
109 1.1.1.1.10.2 tls return (error);
110 1.1.1.1.10.2 tls mtx_lock(&ncl_iod_mutex);
111 1.1.1.1.10.2 tls if (newmin > ncl_iodmax) {
112 1.1.1.1.10.2 tls error = EINVAL;
113 1.1.1.1.10.2 tls goto out;
114 1.1.1.1.10.2 tls }
115 1.1.1.1.10.2 tls nfs_iodmin = newmin;
116 1.1.1.1.10.2 tls if (ncl_numasync >= nfs_iodmin)
117 1.1.1.1.10.2 tls goto out;
118 1.1.1.1.10.2 tls /*
119 1.1.1.1.10.2 tls * If the current number of nfsiod is lower
120 1.1.1.1.10.2 tls * than the new minimum, create some more.
121 1.1.1.1.10.2 tls */
122 1.1.1.1.10.2 tls for (i = nfs_iodmin - ncl_numasync; i > 0; i--)
123 1.1.1.1.10.2 tls nfs_nfsiodnew_sync();
124 1.1.1.1.10.2 tls out:
125 1.1.1.1.10.2 tls mtx_unlock(&ncl_iod_mutex);
126 1.1.1.1.10.2 tls return (0);
127 1.1.1.1.10.2 tls }
128 1.1.1.1.10.2 tls SYSCTL_PROC(_vfs_nfs, OID_AUTO, iodmin, CTLTYPE_UINT | CTLFLAG_RW, 0,
129 1.1.1.1.10.2 tls sizeof (nfs_iodmin), sysctl_iodmin, "IU",
130 1.1.1.1.10.2 tls "Min number of nfsiod kthreads to keep as spares");
131 1.1.1.1.10.2 tls
132 1.1.1.1.10.2 tls static int
133 1.1.1.1.10.2 tls sysctl_iodmax(SYSCTL_HANDLER_ARGS)
134 1.1.1.1.10.2 tls {
135 1.1.1.1.10.2 tls int error, i;
136 1.1.1.1.10.2 tls int iod, newmax;
137 1.1.1.1.10.2 tls
138 1.1.1.1.10.2 tls newmax = ncl_iodmax;
139 1.1.1.1.10.2 tls error = sysctl_handle_int(oidp, &newmax, 0, req);
140 1.1.1.1.10.2 tls if (error || (req->newptr == NULL))
141 1.1.1.1.10.2 tls return (error);
142 1.1.1.1.10.2 tls if (newmax > NFS_MAXASYNCDAEMON)
143 1.1.1.1.10.2 tls return (EINVAL);
144 1.1.1.1.10.2 tls mtx_lock(&ncl_iod_mutex);
145 1.1.1.1.10.2 tls ncl_iodmax = newmax;
146 1.1.1.1.10.2 tls if (ncl_numasync <= ncl_iodmax)
147 1.1.1.1.10.2 tls goto out;
148 1.1.1.1.10.2 tls /*
149 1.1.1.1.10.2 tls * If there are some asleep nfsiods that should
150 1.1.1.1.10.2 tls * exit, wakeup() them so that they check ncl_iodmax
151 1.1.1.1.10.2 tls * and exit. Those who are active will exit as
152 1.1.1.1.10.2 tls * soon as they finish I/O.
153 1.1.1.1.10.2 tls */
154 1.1.1.1.10.2 tls iod = ncl_numasync - 1;
155 1.1.1.1.10.2 tls for (i = 0; i < ncl_numasync - ncl_iodmax; i++) {
156 1.1.1.1.10.2 tls if (ncl_iodwant[iod] == NFSIOD_AVAILABLE)
157 1.1.1.1.10.2 tls wakeup(&ncl_iodwant[iod]);
158 1.1.1.1.10.2 tls iod--;
159 1.1.1.1.10.2 tls }
160 1.1.1.1.10.2 tls out:
161 1.1.1.1.10.2 tls mtx_unlock(&ncl_iod_mutex);
162 1.1.1.1.10.2 tls return (0);
163 1.1.1.1.10.2 tls }
164 1.1.1.1.10.2 tls SYSCTL_PROC(_vfs_nfs, OID_AUTO, iodmax, CTLTYPE_UINT | CTLFLAG_RW, 0,
165 1.1.1.1.10.2 tls sizeof (ncl_iodmax), sysctl_iodmax, "IU",
166 1.1.1.1.10.2 tls "Max number of nfsiod kthreads");
167 1.1.1.1.10.2 tls
168 1.1.1.1.10.2 tls static int
169 1.1.1.1.10.2 tls nfs_nfsiodnew_sync(void)
170 1.1.1.1.10.2 tls {
171 1.1.1.1.10.2 tls int error, i;
172 1.1.1.1.10.2 tls
173 1.1.1.1.10.2 tls mtx_assert(&ncl_iod_mutex, MA_OWNED);
174 1.1.1.1.10.2 tls for (i = 0; i < ncl_iodmax; i++) {
175 1.1.1.1.10.2 tls if (nfs_asyncdaemon[i] == 0) {
176 1.1.1.1.10.2 tls nfs_asyncdaemon[i] = 1;
177 1.1.1.1.10.2 tls break;
178 1.1.1.1.10.2 tls }
179 1.1.1.1.10.2 tls }
180 1.1.1.1.10.2 tls if (i == ncl_iodmax)
181 1.1.1.1.10.2 tls return (0);
182 1.1.1.1.10.2 tls mtx_unlock(&ncl_iod_mutex);
183 1.1.1.1.10.2 tls error = kproc_create(nfssvc_iod, nfs_asyncdaemon + i, NULL,
184 1.1.1.1.10.2 tls RFHIGHPID, 0, "newnfs %d", i);
185 1.1.1.1.10.2 tls mtx_lock(&ncl_iod_mutex);
186 1.1.1.1.10.2 tls if (error == 0) {
187 1.1.1.1.10.2 tls ncl_numasync++;
188 1.1.1.1.10.2 tls ncl_iodwant[i] = NFSIOD_AVAILABLE;
189 1.1.1.1.10.2 tls } else
190 1.1.1.1.10.2 tls nfs_asyncdaemon[i] = 0;
191 1.1.1.1.10.2 tls return (error);
192 1.1.1.1.10.2 tls }
193 1.1.1.1.10.2 tls
194 1.1.1.1.10.2 tls void
195 1.1.1.1.10.2 tls ncl_nfsiodnew_tq(__unused void *arg, int pending)
196 1.1.1.1.10.2 tls {
197 1.1.1.1.10.2 tls
198 1.1.1.1.10.2 tls mtx_lock(&ncl_iod_mutex);
199 1.1.1.1.10.2 tls while (pending > 0) {
200 1.1.1.1.10.2 tls pending--;
201 1.1.1.1.10.2 tls nfs_nfsiodnew_sync();
202 1.1.1.1.10.2 tls }
203 1.1.1.1.10.2 tls mtx_unlock(&ncl_iod_mutex);
204 1.1.1.1.10.2 tls }
205 1.1.1.1.10.2 tls
206 1.1.1.1.10.2 tls void
207 1.1.1.1.10.2 tls ncl_nfsiodnew(void)
208 1.1.1.1.10.2 tls {
209 1.1.1.1.10.2 tls
210 1.1.1.1.10.2 tls mtx_assert(&ncl_iod_mutex, MA_OWNED);
211 1.1.1.1.10.2 tls taskqueue_enqueue(taskqueue_thread, &ncl_nfsiodnew_task);
212 1.1.1.1.10.2 tls }
213 1.1.1.1.10.2 tls
214 1.1.1.1.10.2 tls static void
215 1.1.1.1.10.2 tls nfsiod_setup(void *dummy)
216 1.1.1.1.10.2 tls {
217 1.1.1.1.10.2 tls int error;
218 1.1.1.1.10.2 tls
219 1.1.1.1.10.2 tls TUNABLE_INT_FETCH("vfs.nfs.iodmin", &nfs_iodmin);
220 1.1.1.1.10.2 tls nfscl_init();
221 1.1.1.1.10.2 tls mtx_lock(&ncl_iod_mutex);
222 1.1.1.1.10.2 tls /* Silently limit the start number of nfsiod's */
223 1.1.1.1.10.2 tls if (nfs_iodmin > NFS_MAXASYNCDAEMON)
224 1.1.1.1.10.2 tls nfs_iodmin = NFS_MAXASYNCDAEMON;
225 1.1.1.1.10.2 tls
226 1.1.1.1.10.2 tls while (ncl_numasync < nfs_iodmin) {
227 1.1.1.1.10.2 tls error = nfs_nfsiodnew_sync();
228 1.1.1.1.10.2 tls if (error == -1)
229 1.1.1.1.10.2 tls panic("nfsiod_setup: nfs_nfsiodnew failed");
230 1.1.1.1.10.2 tls }
231 1.1.1.1.10.2 tls mtx_unlock(&ncl_iod_mutex);
232 1.1.1.1.10.2 tls }
233 1.1.1.1.10.2 tls SYSINIT(newnfsiod, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY, nfsiod_setup, NULL);
234 1.1.1.1.10.2 tls
235 1.1.1.1.10.2 tls static int nfs_defect = 0;
236 1.1.1.1.10.2 tls SYSCTL_INT(_vfs_nfs, OID_AUTO, defect, CTLFLAG_RW, &nfs_defect, 0,
237 1.1.1.1.10.2 tls "Allow nfsiods to migrate serving different mounts");
238 1.1.1.1.10.2 tls
239 1.1.1.1.10.2 tls /*
240 1.1.1.1.10.2 tls * Asynchronous I/O daemons for client nfs.
241 1.1.1.1.10.2 tls * They do read-ahead and write-behind operations on the block I/O cache.
242 1.1.1.1.10.2 tls * Returns if we hit the timeout defined by the iodmaxidle sysctl.
243 1.1.1.1.10.2 tls */
244 1.1.1.1.10.2 tls static void
245 1.1.1.1.10.2 tls nfssvc_iod(void *instance)
246 1.1.1.1.10.2 tls {
247 1.1.1.1.10.2 tls struct buf *bp;
248 1.1.1.1.10.2 tls struct nfsmount *nmp;
249 1.1.1.1.10.2 tls int myiod, timo;
250 1.1.1.1.10.2 tls int error = 0;
251 1.1.1.1.10.2 tls
252 1.1.1.1.10.2 tls mtx_lock(&ncl_iod_mutex);
253 1.1.1.1.10.2 tls myiod = (int *)instance - nfs_asyncdaemon;
254 1.1.1.1.10.2 tls /*
255 1.1.1.1.10.2 tls * Main loop
256 1.1.1.1.10.2 tls */
257 1.1.1.1.10.2 tls for (;;) {
258 1.1.1.1.10.2 tls while (((nmp = ncl_iodmount[myiod]) == NULL)
259 1.1.1.1.10.2 tls || !TAILQ_FIRST(&nmp->nm_bufq)) {
260 1.1.1.1.10.2 tls if (myiod >= ncl_iodmax)
261 1.1.1.1.10.2 tls goto finish;
262 1.1.1.1.10.2 tls if (nmp)
263 1.1.1.1.10.2 tls nmp->nm_bufqiods--;
264 1.1.1.1.10.2 tls if (ncl_iodwant[myiod] == NFSIOD_NOT_AVAILABLE)
265 1.1.1.1.10.2 tls ncl_iodwant[myiod] = NFSIOD_AVAILABLE;
266 1.1.1.1.10.2 tls ncl_iodmount[myiod] = NULL;
267 1.1.1.1.10.2 tls /*
268 1.1.1.1.10.2 tls * Always keep at least nfs_iodmin kthreads.
269 1.1.1.1.10.2 tls */
270 1.1.1.1.10.2 tls timo = (myiod < nfs_iodmin) ? 0 : nfs_iodmaxidle * hz;
271 1.1.1.1.10.2 tls error = msleep(&ncl_iodwant[myiod], &ncl_iod_mutex, PWAIT | PCATCH,
272 1.1.1.1.10.2 tls "-", timo);
273 1.1.1.1.10.2 tls if (error) {
274 1.1.1.1.10.2 tls nmp = ncl_iodmount[myiod];
275 1.1.1.1.10.2 tls /*
276 1.1.1.1.10.2 tls * Rechecking the nm_bufq closes a rare race where the
277 1.1.1.1.10.2 tls * nfsiod is woken up at the exact time the idle timeout
278 1.1.1.1.10.2 tls * fires
279 1.1.1.1.10.2 tls */
280 1.1.1.1.10.2 tls if (nmp && TAILQ_FIRST(&nmp->nm_bufq))
281 1.1.1.1.10.2 tls error = 0;
282 1.1.1.1.10.2 tls break;
283 1.1.1.1.10.2 tls }
284 1.1.1.1.10.2 tls }
285 1.1.1.1.10.2 tls if (error)
286 1.1.1.1.10.2 tls break;
287 1.1.1.1.10.2 tls while ((bp = TAILQ_FIRST(&nmp->nm_bufq)) != NULL) {
288 1.1.1.1.10.2 tls /* Take one off the front of the list */
289 1.1.1.1.10.2 tls TAILQ_REMOVE(&nmp->nm_bufq, bp, b_freelist);
290 1.1.1.1.10.2 tls nmp->nm_bufqlen--;
291 1.1.1.1.10.2 tls if (nmp->nm_bufqwant && nmp->nm_bufqlen <= ncl_numasync) {
292 1.1.1.1.10.2 tls nmp->nm_bufqwant = 0;
293 1.1.1.1.10.2 tls wakeup(&nmp->nm_bufq);
294 1.1.1.1.10.2 tls }
295 1.1.1.1.10.2 tls mtx_unlock(&ncl_iod_mutex);
296 1.1.1.1.10.2 tls if (bp->b_flags & B_DIRECT) {
297 1.1.1.1.10.2 tls KASSERT((bp->b_iocmd == BIO_WRITE), ("nfscvs_iod: BIO_WRITE not set"));
298 1.1.1.1.10.2 tls (void)ncl_doio_directwrite(bp);
299 1.1.1.1.10.2 tls } else {
300 1.1.1.1.10.2 tls if (bp->b_iocmd == BIO_READ)
301 1.1.1.1.10.2 tls (void) ncl_doio(bp->b_vp, bp, bp->b_rcred,
302 1.1.1.1.10.2 tls NULL, 0);
303 1.1.1.1.10.2 tls else
304 1.1.1.1.10.2 tls (void) ncl_doio(bp->b_vp, bp, bp->b_wcred,
305 1.1.1.1.10.2 tls NULL, 0);
306 1.1.1.1.10.2 tls }
307 1.1.1.1.10.2 tls mtx_lock(&ncl_iod_mutex);
308 1.1.1.1.10.2 tls /*
309 1.1.1.1.10.2 tls * Make sure the nmp hasn't been dismounted as soon as
310 1.1.1.1.10.2 tls * ncl_doio() completes for the last buffer.
311 1.1.1.1.10.2 tls */
312 1.1.1.1.10.2 tls nmp = ncl_iodmount[myiod];
313 1.1.1.1.10.2 tls if (nmp == NULL)
314 1.1.1.1.10.2 tls break;
315 1.1.1.1.10.2 tls
316 1.1.1.1.10.2 tls /*
317 1.1.1.1.10.2 tls * If there are more than one iod on this mount, then defect
318 1.1.1.1.10.2 tls * so that the iods can be shared out fairly between the mounts
319 1.1.1.1.10.2 tls */
320 1.1.1.1.10.2 tls if (nfs_defect && nmp->nm_bufqiods > 1) {
321 1.1.1.1.10.2 tls NFS_DPF(ASYNCIO,
322 1.1.1.1.10.2 tls ("nfssvc_iod: iod %d defecting from mount %p\n",
323 1.1.1.1.10.2 tls myiod, nmp));
324 1.1.1.1.10.2 tls ncl_iodmount[myiod] = NULL;
325 1.1.1.1.10.2 tls nmp->nm_bufqiods--;
326 1.1.1.1.10.2 tls break;
327 1.1.1.1.10.2 tls }
328 1.1.1.1.10.2 tls }
329 1.1.1.1.10.2 tls }
330 1.1.1.1.10.2 tls finish:
331 1.1.1.1.10.2 tls nfs_asyncdaemon[myiod] = 0;
332 1.1.1.1.10.2 tls if (nmp)
333 1.1.1.1.10.2 tls nmp->nm_bufqiods--;
334 1.1.1.1.10.2 tls ncl_iodwant[myiod] = NFSIOD_NOT_AVAILABLE;
335 1.1.1.1.10.2 tls ncl_iodmount[myiod] = NULL;
336 1.1.1.1.10.2 tls /* Someone may be waiting for the last nfsiod to terminate. */
337 1.1.1.1.10.2 tls if (--ncl_numasync == 0)
338 1.1.1.1.10.2 tls wakeup(&ncl_numasync);
339 1.1.1.1.10.2 tls mtx_unlock(&ncl_iod_mutex);
340 1.1.1.1.10.2 tls if ((error == 0) || (error == EWOULDBLOCK))
341 1.1.1.1.10.2 tls kproc_exit(0);
342 1.1.1.1.10.2 tls /* Abnormal termination */
343 1.1.1.1.10.2 tls kproc_exit(1);
344 1.1.1.1.10.2 tls }
345