amfs_nfsx.c revision 1.1.1.3 1 1.1 christos /* $NetBSD: amfs_nfsx.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
2 1.1 christos
3 1.1 christos /*
4 1.1.1.3 christos * Copyright (c) 1997-2014 Erez Zadok
5 1.1 christos * Copyright (c) 1990 Jan-Simon Pendry
6 1.1 christos * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
7 1.1 christos * Copyright (c) 1990 The Regents of the University of California.
8 1.1 christos * All rights reserved.
9 1.1 christos *
10 1.1 christos * This code is derived from software contributed to Berkeley by
11 1.1 christos * Jan-Simon Pendry at Imperial College, London.
12 1.1 christos *
13 1.1 christos * Redistribution and use in source and binary forms, with or without
14 1.1 christos * modification, are permitted provided that the following conditions
15 1.1 christos * are met:
16 1.1 christos * 1. Redistributions of source code must retain the above copyright
17 1.1 christos * notice, this list of conditions and the following disclaimer.
18 1.1 christos * 2. Redistributions in binary form must reproduce the above copyright
19 1.1 christos * notice, this list of conditions and the following disclaimer in the
20 1.1 christos * documentation and/or other materials provided with the distribution.
21 1.1.1.3 christos * 3. Neither the name of the University nor the names of its contributors
22 1.1 christos * may be used to endorse or promote products derived from this software
23 1.1 christos * without specific prior written permission.
24 1.1 christos *
25 1.1 christos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 1.1 christos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 1.1 christos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 1.1 christos * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 1.1 christos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 1.1 christos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 1.1 christos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 1.1 christos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 1.1 christos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 1.1 christos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 1.1 christos * SUCH DAMAGE.
36 1.1 christos *
37 1.1 christos *
38 1.1 christos * File: am-utils/amd/amfs_nfsx.c
39 1.1 christos *
40 1.1 christos */
41 1.1 christos
42 1.1 christos /*
43 1.1 christos * NFS hierarchical mounts
44 1.1 christos *
45 1.1 christos * TODO: Re-implement.
46 1.1 christos */
47 1.1 christos
48 1.1 christos #ifdef HAVE_CONFIG_H
49 1.1 christos # include <config.h>
50 1.1 christos #endif /* HAVE_CONFIG_H */
51 1.1 christos #include <am_defs.h>
52 1.1 christos #include <amd.h>
53 1.1 christos
54 1.1 christos /*
55 1.1 christos * The rfs field contains a list of mounts to be done from
56 1.1 christos * the remote host.
57 1.1 christos */
58 1.1 christos typedef struct amfs_nfsx_mnt {
59 1.1 christos mntfs *n_mnt;
60 1.1 christos int n_error;
61 1.1 christos } amfs_nfsx_mnt;
62 1.1 christos
63 1.1 christos struct amfs_nfsx {
64 1.1 christos int nx_c; /* Number of elements in nx_v */
65 1.1 christos amfs_nfsx_mnt *nx_v; /* Underlying mounts */
66 1.1 christos amfs_nfsx_mnt *nx_try;
67 1.1 christos am_node *nx_mp;
68 1.1 christos };
69 1.1 christos
70 1.1 christos /* forward definitions */
71 1.1 christos static char *amfs_nfsx_match(am_opts *fo);
72 1.1 christos static int amfs_nfsx_mount(am_node *am, mntfs *mf);
73 1.1 christos static int amfs_nfsx_umount(am_node *am, mntfs *mf);
74 1.1 christos static int amfs_nfsx_init(mntfs *mf);
75 1.1 christos
76 1.1 christos /*
77 1.1 christos * Ops structure
78 1.1 christos */
79 1.1 christos am_ops amfs_nfsx_ops =
80 1.1 christos {
81 1.1 christos "nfsx",
82 1.1 christos amfs_nfsx_match,
83 1.1 christos amfs_nfsx_init,
84 1.1 christos amfs_nfsx_mount,
85 1.1 christos amfs_nfsx_umount,
86 1.1 christos amfs_error_lookup_child,
87 1.1 christos amfs_error_mount_child,
88 1.1 christos amfs_error_readdir,
89 1.1 christos 0, /* amfs_nfsx_readlink */
90 1.1 christos 0, /* amfs_nfsx_mounted */
91 1.1 christos 0, /* amfs_nfsx_umounted */
92 1.1 christos find_nfs_srvr, /* XXX */
93 1.1 christos 0, /* amfs_nfsx_get_wchan */
94 1.1 christos /* FS_UBACKGROUND| */ FS_AMQINFO, /* nfs_fs_flags */
95 1.1 christos #ifdef HAVE_FS_AUTOFS
96 1.1 christos AUTOFS_NFSX_FS_FLAGS,
97 1.1 christos #endif /* HAVE_FS_AUTOFS */
98 1.1 christos };
99 1.1 christos
100 1.1 christos
101 1.1 christos static char *
102 1.1 christos amfs_nfsx_match(am_opts *fo)
103 1.1 christos {
104 1.1 christos char *xmtab;
105 1.1 christos char *ptr;
106 1.1 christos int len;
107 1.1 christos
108 1.1 christos if (!fo->opt_rfs) {
109 1.1 christos plog(XLOG_USER, "amfs_nfsx: no remote filesystem specified");
110 1.1 christos return FALSE;
111 1.1 christos }
112 1.1 christos
113 1.1 christos if (!fo->opt_rhost) {
114 1.1 christos plog(XLOG_USER, "amfs_nfsx: no remote host specified");
115 1.1 christos return FALSE;
116 1.1 christos }
117 1.1 christos
118 1.1 christos /* set default sublink */
119 1.1.1.2 christos if (fo->opt_sublink == NULL || fo->opt_sublink[0] == '\0') {
120 1.1 christos ptr = strchr(fo->opt_rfs, ',');
121 1.1 christos if (ptr && ptr > (fo->opt_rfs + 1))
122 1.1 christos fo->opt_sublink = strnsave(fo->opt_rfs + 1, ptr - fo->opt_rfs - 1);
123 1.1 christos }
124 1.1 christos
125 1.1 christos /*
126 1.1 christos * Remove trailing ",..." from ${fs}
127 1.1 christos * After deslashifying, overwrite the end of ${fs} with "/"
128 1.1 christos * to make sure it is unique.
129 1.1 christos */
130 1.1 christos if ((ptr = strchr(fo->opt_fs, ',')))
131 1.1 christos *ptr = '\0';
132 1.1 christos deslashify(fo->opt_fs);
133 1.1 christos
134 1.1 christos /*
135 1.1 christos * Bump string length to allow trailing /
136 1.1 christos */
137 1.1 christos len = strlen(fo->opt_fs);
138 1.1 christos fo->opt_fs = xrealloc(fo->opt_fs, len + 1 + 1);
139 1.1 christos ptr = fo->opt_fs + len;
140 1.1 christos
141 1.1 christos /*
142 1.1 christos * Make unique...
143 1.1 christos */
144 1.1 christos *ptr++ = '/';
145 1.1 christos *ptr = '\0';
146 1.1 christos
147 1.1 christos /*
148 1.1 christos * Determine magic cookie to put in mtab
149 1.1 christos */
150 1.1 christos xmtab = str3cat((char *) NULL, fo->opt_rhost, ":", fo->opt_rfs);
151 1.1 christos dlog("NFSX: mounting remote server \"%s\", remote fs \"%s\" on \"%s\"",
152 1.1 christos fo->opt_rhost, fo->opt_rfs, fo->opt_fs);
153 1.1 christos
154 1.1 christos return xmtab;
155 1.1 christos }
156 1.1 christos
157 1.1 christos
158 1.1 christos static void
159 1.1 christos amfs_nfsx_prfree(opaque_t vp)
160 1.1 christos {
161 1.1 christos struct amfs_nfsx *nx = (struct amfs_nfsx *) vp;
162 1.1 christos int i;
163 1.1 christos
164 1.1 christos for (i = 0; i < nx->nx_c; i++) {
165 1.1 christos mntfs *m = nx->nx_v[i].n_mnt;
166 1.1 christos if (m)
167 1.1 christos free_mntfs(m);
168 1.1 christos }
169 1.1 christos
170 1.1 christos XFREE(nx->nx_v);
171 1.1 christos XFREE(nx);
172 1.1 christos }
173 1.1 christos
174 1.1 christos
175 1.1 christos static int
176 1.1 christos amfs_nfsx_init(mntfs *mf)
177 1.1 christos {
178 1.1 christos /*
179 1.1 christos * mf_info has the form:
180 1.1 christos * host:/prefix/path,sub,sub,sub
181 1.1 christos */
182 1.1 christos int i;
183 1.1 christos int glob_error;
184 1.1 christos struct amfs_nfsx *nx;
185 1.1 christos int asked_for_wakeup = 0;
186 1.1 christos
187 1.1 christos nx = (struct amfs_nfsx *) mf->mf_private;
188 1.1 christos
189 1.1 christos if (nx == 0) {
190 1.1 christos char **ivec;
191 1.1 christos char *info = NULL;
192 1.1 christos char *host;
193 1.1 christos char *pref;
194 1.1 christos int error = 0;
195 1.1 christos
196 1.1.1.3 christos info = xstrdup(mf->mf_info);
197 1.1.1.3 christos if (info == NULL)
198 1.1.1.3 christos return errno;
199 1.1.1.3 christos
200 1.1 christos host = strchr(info, ':');
201 1.1 christos if (!host) {
202 1.1 christos error = EINVAL;
203 1.1 christos goto errexit;
204 1.1 christos }
205 1.1 christos pref = host + 1;
206 1.1 christos host = info;
207 1.1 christos
208 1.1 christos /*
209 1.1 christos * Split the prefix off from the suffices
210 1.1 christos */
211 1.1 christos ivec = strsplit(pref, ',', '\'');
212 1.1 christos
213 1.1 christos /*
214 1.1 christos * Count array size
215 1.1 christos */
216 1.1 christos for (i = 0; ivec[i]; i++)
217 1.1 christos /* nothing */;
218 1.1 christos
219 1.1 christos nx = ALLOC(struct amfs_nfsx);
220 1.1 christos mf->mf_private = (opaque_t) nx;
221 1.1 christos mf->mf_prfree = amfs_nfsx_prfree;
222 1.1 christos
223 1.1 christos nx->nx_c = i - 1; /* i-1 because we don't want the prefix */
224 1.1 christos nx->nx_v = (amfs_nfsx_mnt *) xmalloc(nx->nx_c * sizeof(amfs_nfsx_mnt));
225 1.1 christos nx->nx_mp = NULL;
226 1.1 christos {
227 1.1 christos char *mp = NULL;
228 1.1 christos char *xinfo = NULL;
229 1.1 christos char *fs = mf->mf_fo->opt_fs;
230 1.1 christos char *rfs = NULL;
231 1.1 christos for (i = 0; i < nx->nx_c; i++) {
232 1.1 christos char *path = ivec[i + 1];
233 1.1 christos rfs = str3cat(rfs, pref, "/", path);
234 1.1 christos /*
235 1.1 christos * Determine the mount point.
236 1.1 christos * If this is the root, then don't remove
237 1.1 christos * the trailing slash to avoid mntfs name clashes.
238 1.1 christos */
239 1.1 christos mp = str3cat(mp, fs, "/", rfs);
240 1.1 christos normalize_slash(mp);
241 1.1 christos deslashify(mp);
242 1.1 christos /*
243 1.1 christos * Determine the mount info
244 1.1 christos */
245 1.1 christos xinfo = str3cat(xinfo, host, *path == '/' ? "" : "/", path);
246 1.1 christos normalize_slash(xinfo);
247 1.1 christos if (pref[1] != '\0')
248 1.1 christos deslashify(xinfo);
249 1.1 christos dlog("amfs_nfsx: init mount for %s on %s", xinfo, mp);
250 1.1 christos nx->nx_v[i].n_error = -1;
251 1.1 christos nx->nx_v[i].n_mnt = find_mntfs(&nfs_ops, mf->mf_fo, mp, xinfo, "", mf->mf_mopts, mf->mf_remopts);
252 1.1 christos /* propagate the on_autofs flag */
253 1.1 christos nx->nx_v[i].n_mnt->mf_flags |= mf->mf_flags & MFF_ON_AUTOFS;
254 1.1 christos }
255 1.1.1.3 christos XFREE(rfs);
256 1.1.1.3 christos XFREE(mp);
257 1.1.1.3 christos XFREE(xinfo);
258 1.1 christos }
259 1.1 christos
260 1.1 christos XFREE(ivec);
261 1.1 christos errexit:
262 1.1.1.3 christos XFREE(info);
263 1.1 christos if (error)
264 1.1 christos return error;
265 1.1 christos }
266 1.1 christos
267 1.1 christos /*
268 1.1 christos * Iterate through the mntfs's and call
269 1.1 christos * the underlying init routine on each
270 1.1 christos */
271 1.1 christos glob_error = 0;
272 1.1 christos
273 1.1 christos for (i = 0; i < nx->nx_c; i++) {
274 1.1 christos amfs_nfsx_mnt *n = &nx->nx_v[i];
275 1.1 christos mntfs *m = n->n_mnt;
276 1.1 christos int error = 0;
277 1.1 christos if (m->mf_ops->fs_init && !(mf->mf_flags & MFF_RESTART))
278 1.1 christos error = m->mf_ops->fs_init(m);
279 1.1 christos /*
280 1.1 christos * if you just "return error" here, you will have made a failure
281 1.1 christos * in any submounts to fail the whole group. There was old unused code
282 1.1 christos * here before.
283 1.1 christos */
284 1.1 christos if (error > 0)
285 1.1 christos n->n_error = error;
286 1.1 christos
287 1.1 christos else if (error < 0) {
288 1.1 christos glob_error = -1;
289 1.1 christos if (!asked_for_wakeup) {
290 1.1 christos asked_for_wakeup = 1;
291 1.1 christos sched_task(wakeup_task, (opaque_t) mf, get_mntfs_wchan(m));
292 1.1 christos }
293 1.1 christos }
294 1.1 christos }
295 1.1 christos
296 1.1 christos return glob_error;
297 1.1 christos }
298 1.1 christos
299 1.1 christos
300 1.1 christos static void
301 1.1 christos amfs_nfsx_cont(int rc, int term, opaque_t arg)
302 1.1 christos {
303 1.1 christos mntfs *mf = (mntfs *) arg;
304 1.1 christos struct amfs_nfsx *nx = (struct amfs_nfsx *) mf->mf_private;
305 1.1 christos am_node *mp = nx->nx_mp;
306 1.1 christos amfs_nfsx_mnt *n = nx->nx_try;
307 1.1 christos
308 1.1 christos n->n_mnt->mf_flags &= ~(MFF_ERROR | MFF_MOUNTING);
309 1.1 christos mf->mf_flags &= ~MFF_ERROR;
310 1.1 christos
311 1.1 christos /*
312 1.1 christos * Wakeup anything waiting for this mount
313 1.1 christos */
314 1.1 christos wakeup(get_mntfs_wchan(n->n_mnt));
315 1.1 christos
316 1.1 christos if (rc || term) {
317 1.1 christos if (term) {
318 1.1 christos /*
319 1.1 christos * Not sure what to do for an error code.
320 1.1 christos */
321 1.1 christos plog(XLOG_ERROR, "mount for %s got signal %d", n->n_mnt->mf_mount, term);
322 1.1 christos n->n_error = EIO;
323 1.1 christos } else {
324 1.1 christos /*
325 1.1 christos * Check for exit status
326 1.1 christos */
327 1.1 christos errno = rc; /* XXX */
328 1.1 christos plog(XLOG_ERROR, "%s: mount (amfs_nfsx_cont): %m", n->n_mnt->mf_mount);
329 1.1 christos n->n_error = rc;
330 1.1 christos }
331 1.1 christos free_mntfs(n->n_mnt);
332 1.1 christos n->n_mnt = new_mntfs();
333 1.1 christos n->n_mnt->mf_error = n->n_error;
334 1.1 christos n->n_mnt->mf_flags |= MFF_ERROR;
335 1.1 christos } else {
336 1.1 christos /*
337 1.1 christos * The mount worked.
338 1.1 christos */
339 1.1 christos mf_mounted(n->n_mnt, FALSE); /* FALSE => don't free the n_mnt->am_opts */
340 1.1 christos n->n_error = 0;
341 1.1 christos }
342 1.1 christos
343 1.1 christos /*
344 1.1 christos * Do the remaining bits
345 1.1 christos */
346 1.1 christos if (amfs_nfsx_mount(mp, mf) >= 0)
347 1.1 christos wakeup(get_mntfs_wchan(mf));
348 1.1 christos }
349 1.1 christos
350 1.1 christos
351 1.1 christos static int
352 1.1 christos try_amfs_nfsx_mount(opaque_t mv)
353 1.1 christos {
354 1.1 christos mntfs *mf = (mntfs *) mv;
355 1.1 christos struct amfs_nfsx *nx = (struct amfs_nfsx *) mf->mf_private;
356 1.1 christos am_node *mp = nx->nx_mp;
357 1.1 christos int error;
358 1.1 christos
359 1.1 christos error = mf->mf_ops->mount_fs(mp, mf);
360 1.1 christos
361 1.1 christos return error;
362 1.1 christos }
363 1.1 christos
364 1.1 christos
365 1.1 christos static int
366 1.1 christos amfs_nfsx_remount(am_node *am, mntfs *mf, int fg)
367 1.1 christos {
368 1.1 christos struct amfs_nfsx *nx = (struct amfs_nfsx *) mf->mf_private;
369 1.1 christos amfs_nfsx_mnt *n;
370 1.1 christos int glob_error = -1;
371 1.1 christos
372 1.1 christos /* Save the am_node pointer for later use */
373 1.1 christos nx->nx_mp = am;
374 1.1 christos
375 1.1 christos /*
376 1.1 christos * Iterate through the mntfs's and mount each filesystem
377 1.1 christos * which is not yet mounted.
378 1.1 christos */
379 1.1 christos for (n = nx->nx_v; n < nx->nx_v + nx->nx_c; n++) {
380 1.1 christos mntfs *m = n->n_mnt;
381 1.1 christos
382 1.1 christos if (m->mf_flags & MFF_MOUNTING)
383 1.1 christos break;
384 1.1 christos
385 1.1 christos if (m->mf_flags & MFF_MOUNTED) {
386 1.1 christos mf_mounted(m, FALSE); /* FALSE => don't free the m->am_opts */
387 1.1 christos n->n_error = glob_error = 0;
388 1.1 christos continue;
389 1.1 christos }
390 1.1 christos
391 1.1 christos if (n->n_error < 0) {
392 1.1 christos /* Create the mountpoint, if and as required */
393 1.1 christos if (!(m->mf_flags & MFF_MKMNT) && m->mf_fsflags & FS_MKMNT) {
394 1.1 christos if (!mkdirs(m->mf_mount, 0555))
395 1.1 christos m->mf_flags |= MFF_MKMNT;
396 1.1 christos }
397 1.1 christos
398 1.1 christos dlog("calling underlying mount on %s", m->mf_mount);
399 1.1 christos if (!fg && foreground && (m->mf_fsflags & FS_MBACKGROUND)) {
400 1.1 christos m->mf_flags |= MFF_MOUNTING;
401 1.1 christos dlog("backgrounding mount of \"%s\"", m->mf_info);
402 1.1 christos nx->nx_try = n;
403 1.1 christos run_task(try_amfs_nfsx_mount, (opaque_t) m, amfs_nfsx_cont, (opaque_t) mf);
404 1.1 christos n->n_error = -1;
405 1.1 christos return -1;
406 1.1 christos } else {
407 1.1 christos dlog("foreground mount of \"%s\" ...", mf->mf_info);
408 1.1 christos n->n_error = m->mf_ops->mount_fs(am, m);
409 1.1 christos }
410 1.1 christos
411 1.1 christos if (n->n_error > 0)
412 1.1 christos dlog("underlying fmount of %s failed: %s", m->mf_mount, strerror(n->n_error));
413 1.1 christos
414 1.1 christos if (n->n_error == 0) {
415 1.1 christos glob_error = 0;
416 1.1 christos } else if (glob_error < 0) {
417 1.1 christos glob_error = n->n_error;
418 1.1 christos }
419 1.1 christos }
420 1.1 christos }
421 1.1 christos
422 1.1 christos return glob_error < 0 ? 0 : glob_error;
423 1.1 christos }
424 1.1 christos
425 1.1 christos
426 1.1 christos static int
427 1.1 christos amfs_nfsx_mount(am_node *am, mntfs *mf)
428 1.1 christos {
429 1.1 christos return amfs_nfsx_remount(am, mf, FALSE);
430 1.1 christos }
431 1.1 christos
432 1.1 christos
433 1.1 christos /*
434 1.1 christos * Unmount an NFS hierarchy.
435 1.1 christos * Note that this is called in the foreground
436 1.1 christos * and so may hang under extremely rare conditions.
437 1.1 christos */
438 1.1 christos static int
439 1.1 christos amfs_nfsx_umount(am_node *am, mntfs *mf)
440 1.1 christos {
441 1.1 christos struct amfs_nfsx *nx = (struct amfs_nfsx *) mf->mf_private;
442 1.1 christos amfs_nfsx_mnt *n;
443 1.1 christos int glob_error = 0;
444 1.1 christos
445 1.1 christos /*
446 1.1 christos * Iterate in reverse through the mntfs's and unmount each filesystem
447 1.1 christos * which is mounted.
448 1.1 christos */
449 1.1 christos for (n = nx->nx_v + nx->nx_c - 1; n >= nx->nx_v; --n) {
450 1.1 christos mntfs *m = n->n_mnt;
451 1.1 christos /*
452 1.1 christos * If this node has not been messed with
453 1.1 christos * and there has been no error so far
454 1.1 christos * then try and unmount.
455 1.1 christos * If an error had occurred then zero
456 1.1 christos * the error code so that the remount
457 1.1 christos * only tries to unmount those nodes
458 1.1 christos * which had been successfully unmounted.
459 1.1 christos */
460 1.1 christos if (n->n_error == 0) {
461 1.1 christos dlog("calling underlying fumount on %s", m->mf_mount);
462 1.1 christos n->n_error = m->mf_ops->umount_fs(am, m);
463 1.1 christos if (n->n_error) {
464 1.1 christos glob_error = n->n_error;
465 1.1 christos n->n_error = 0;
466 1.1 christos } else {
467 1.1 christos /*
468 1.1 christos * Make sure remount gets this node
469 1.1 christos */
470 1.1 christos n->n_error = -1;
471 1.1 christos }
472 1.1 christos }
473 1.1 christos }
474 1.1 christos
475 1.1 christos /*
476 1.1 christos * If any unmounts failed then remount the
477 1.1 christos * whole lot...
478 1.1 christos */
479 1.1 christos if (glob_error) {
480 1.1 christos glob_error = amfs_nfsx_remount(am, mf, TRUE);
481 1.1 christos if (glob_error) {
482 1.1 christos errno = glob_error; /* XXX */
483 1.1 christos plog(XLOG_USER, "amfs_nfsx: remount of %s failed: %m", mf->mf_mount);
484 1.1 christos }
485 1.1 christos glob_error = EBUSY;
486 1.1 christos } else {
487 1.1 christos /*
488 1.1 christos * Remove all the mount points
489 1.1 christos */
490 1.1 christos for (n = nx->nx_v; n < nx->nx_v + nx->nx_c; n++) {
491 1.1 christos mntfs *m = n->n_mnt;
492 1.1 christos dlog("calling underlying umounted on %s", m->mf_mount);
493 1.1 christos if (m->mf_ops->umounted)
494 1.1 christos m->mf_ops->umounted(m);
495 1.1 christos
496 1.1 christos if (n->n_error < 0) {
497 1.1 christos if (m->mf_fsflags & FS_MKMNT) {
498 1.1 christos (void) rmdirs(m->mf_mount);
499 1.1 christos m->mf_flags &= ~MFF_MKMNT;
500 1.1 christos }
501 1.1 christos }
502 1.1 christos free_mntfs(m);
503 1.1 christos n->n_mnt = NULL;
504 1.1 christos n->n_error = -1;
505 1.1 christos }
506 1.1 christos }
507 1.1 christos
508 1.1 christos return glob_error;
509 1.1 christos }
510