1 /* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * %sccs.include.redist.c% 9 * 10 * @(#)nfs_vfsops.c 8.1 (Berkeley) 06/10/93 11 */ 12 13 #include <sys/param.h> 14 #include <sys/conf.h> 15 #include <sys/ioctl.h> 16 #include <sys/signal.h> 17 #include <sys/proc.h> 18 #include <sys/namei.h> 19 #include <sys/vnode.h> 20 #include <sys/kernel.h> 21 #include <sys/mount.h> 22 #include <sys/buf.h> 23 #include <sys/mbuf.h> 24 #include <sys/socket.h> 25 #include <sys/systm.h> 26 27 #include <net/if.h> 28 #include <net/route.h> 29 #include <netinet/in.h> 30 31 #include <nfs/rpcv2.h> 32 #include <nfs/nfsv2.h> 33 #include <nfs/nfsnode.h> 34 #include <nfs/nfsmount.h> 35 #include <nfs/nfs.h> 36 #include <nfs/xdr_subs.h> 37 #include <nfs/nfsm_subs.h> 38 #include <nfs/nfsdiskless.h> 39 #include <nfs/nqnfs.h> 40 41 /* 42 * nfs vfs operations. 43 */ 44 struct vfsops nfs_vfsops = { 45 nfs_mount, 46 nfs_start, 47 nfs_unmount, 48 nfs_root, 49 nfs_quotactl, 50 nfs_statfs, 51 nfs_sync, 52 nfs_vget, 53 nfs_fhtovp, 54 nfs_vptofh, 55 nfs_init, 56 }; 57 58 /* 59 * This structure must be filled in by a primary bootstrap or bootstrap 60 * server for a diskless/dataless machine. It is initialized below just 61 * to ensure that it is allocated to initialized data (.data not .bss). 62 */ 63 struct nfs_diskless nfs_diskless = { 0 }; 64 65 static u_char nfs_mntid; 66 extern u_long nfs_procids[NFS_NPROCS]; 67 extern u_long nfs_prog, nfs_vers; 68 void nfs_disconnect __P((struct nfsmount *)); 69 void nfsargs_ntoh __P((struct nfs_args *)); 70 static struct mount *nfs_mountdiskless __P((char *, char *, int, 71 struct sockaddr_in *, struct nfs_args *, register struct vnode **)); 72 73 #define TRUE 1 74 #define FALSE 0 75 76 /* 77 * nfs statfs call 78 */ 79 int 80 nfs_statfs(mp, sbp, p) 81 struct mount *mp; 82 register struct statfs *sbp; 83 struct proc *p; 84 { 85 register struct vnode *vp; 86 register struct nfsv2_statfs *sfp; 87 register caddr_t cp; 88 register long t1; 89 caddr_t bpos, dpos, cp2; 90 int error = 0, isnq; 91 struct mbuf *mreq, *mrep, *md, *mb, *mb2; 92 struct nfsmount *nmp; 93 struct ucred *cred; 94 struct nfsnode *np; 95 96 nmp = VFSTONFS(mp); 97 isnq = (nmp->nm_flag & NFSMNT_NQNFS); 98 if (error = nfs_nget(mp, &nmp->nm_fh, &np)) 99 return (error); 100 vp = NFSTOV(np); 101 nfsstats.rpccnt[NFSPROC_STATFS]++; 102 cred = crget(); 103 cred->cr_ngroups = 1; 104 nfsm_reqhead(vp, NFSPROC_STATFS, NFSX_FH); 105 nfsm_fhtom(vp); 106 nfsm_request(vp, NFSPROC_STATFS, p, cred); 107 nfsm_dissect(sfp, struct nfsv2_statfs *, NFSX_STATFS(isnq)); 108 sbp->f_type = MOUNT_NFS; 109 sbp->f_flags = nmp->nm_flag; 110 sbp->f_iosize = NFS_MAXDGRAMDATA; 111 sbp->f_bsize = fxdr_unsigned(long, sfp->sf_bsize); 112 sbp->f_blocks = fxdr_unsigned(long, sfp->sf_blocks); 113 sbp->f_bfree = fxdr_unsigned(long, sfp->sf_bfree); 114 sbp->f_bavail = fxdr_unsigned(long, sfp->sf_bavail); 115 if (isnq) { 116 sbp->f_files = fxdr_unsigned(long, sfp->sf_files); 117 sbp->f_ffree = fxdr_unsigned(long, sfp->sf_ffree); 118 } else { 119 sbp->f_files = 0; 120 sbp->f_ffree = 0; 121 } 122 if (sbp != &mp->mnt_stat) { 123 bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); 124 bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); 125 } 126 nfsm_reqdone; 127 vrele(vp); 128 crfree(cred); 129 return (error); 130 } 131 132 /* 133 * Mount a remote root fs via. nfs. This depends on the info in the 134 * nfs_diskless structure that has been filled in properly by some primary 135 * bootstrap. 136 * It goes something like this: 137 * - do enough of "ifconfig" by calling ifioctl() so that the system 138 * can talk to the server 139 * - If nfs_diskless.mygateway is filled in, use that address as 140 * a default gateway. 141 * - hand craft the swap nfs vnode hanging off a fake mount point 142 * if swdevt[0].sw_dev == NODEV 143 * - build the rootfs mount point and call mountnfs() to do the rest. 144 */ 145 int 146 nfs_mountroot() 147 { 148 register struct mount *mp; 149 register struct nfs_diskless *nd = &nfs_diskless; 150 struct socket *so; 151 struct vnode *vp; 152 struct proc *p = curproc; /* XXX */ 153 int error, i, s; 154 155 /* 156 * XXX time must be non-zero when we init the interface or else 157 * the arp code will wedge... 158 */ 159 if (time.tv_sec == 0) 160 time.tv_sec = 1; 161 162 #ifdef notyet 163 /* Set up swap credentials. */ 164 proc0.p_ucred->cr_uid = ntohl(nd->swap_ucred.cr_uid); 165 proc0.p_ucred->cr_gid = ntohl(nd->swap_ucred.cr_gid); 166 if ((proc0.p_ucred->cr_ngroups = ntohs(nd->swap_ucred.cr_ngroups)) > 167 NGROUPS) 168 proc0.p_ucred->cr_ngroups = NGROUPS; 169 for (i = 0; i < proc0.p_ucred->cr_ngroups; i++) 170 proc0.p_ucred->cr_groups[i] = ntohl(nd->swap_ucred.cr_groups[i]); 171 #endif 172 173 /* 174 * Do enough of ifconfig(8) so that the critical net interface can 175 * talk to the server. 176 */ 177 if (error = socreate(nd->myif.ifra_addr.sa_family, &so, SOCK_DGRAM, 0)) 178 panic("nfs_mountroot: socreate: %d", error); 179 if (error = ifioctl(so, SIOCAIFADDR, (caddr_t)&nd->myif, p)) 180 panic("nfs_mountroot: SIOCAIFADDR: %d", error); 181 soclose(so); 182 183 /* 184 * If the gateway field is filled in, set it as the default route. 185 */ 186 if (nd->mygateway.sin_len != 0) { 187 struct sockaddr_in mask, sin; 188 189 bzero((caddr_t)&mask, sizeof(mask)); 190 sin = mask; 191 sin.sin_family = AF_INET; 192 sin.sin_len = sizeof(sin); 193 if (error = rtrequest(RTM_ADD, (struct sockaddr *)&sin, 194 (struct sockaddr *)&nd->mygateway, 195 (struct sockaddr *)&mask, 196 RTF_UP | RTF_GATEWAY, (struct rtentry **)0)) 197 panic("nfs_mountroot: RTM_ADD: %d", error); 198 } 199 200 /* 201 * If swapping to an nfs node (indicated by swdevt[0].sw_dev == NODEV): 202 * Create a fake mount point just for the swap vnode so that the 203 * swap file can be on a different server from the rootfs. 204 */ 205 if (swdevt[0].sw_dev == NODEV) { 206 nd->swap_args.fh = (nfsv2fh_t *)nd->swap_fh; 207 (void) nfs_mountdiskless(nd->swap_hostnam, "/swap", 0, 208 &nd->swap_saddr, &nd->swap_args, &vp); 209 210 /* 211 * Since the swap file is not the root dir of a file system, 212 * hack it to a regular file. 213 */ 214 vp->v_type = VREG; 215 vp->v_flag = 0; 216 swapdev_vp = vp; 217 VREF(vp); 218 swdevt[0].sw_vp = vp; 219 swdevt[0].sw_nblks = ntohl(nd->swap_nblks); 220 } else if (bdevvp(swapdev, &swapdev_vp)) 221 panic("nfs_mountroot: can't setup swapdev_vp"); 222 223 /* 224 * Create the rootfs mount point. 225 */ 226 nd->root_args.fh = (nfsv2fh_t *)nd->root_fh; 227 mp = nfs_mountdiskless(nd->root_hostnam, "/", MNT_RDONLY, 228 &nd->root_saddr, &nd->root_args, &vp); 229 230 if (vfs_lock(mp)) 231 panic("nfs_mountroot: vfs_lock"); 232 rootfs = mp; 233 mp->mnt_next = mp; 234 mp->mnt_prev = mp; 235 mp->mnt_vnodecovered = NULLVP; 236 vfs_unlock(mp); 237 rootvp = vp; 238 239 /* 240 * This is not really an nfs issue, but it is much easier to 241 * set hostname here and then let the "/etc/rc.xxx" files 242 * mount the right /var based upon its preset value. 243 */ 244 bcopy(nd->my_hostnam, hostname, MAXHOSTNAMELEN); 245 hostname[MAXHOSTNAMELEN - 1] = '\0'; 246 for (i = 0; i < MAXHOSTNAMELEN; i++) 247 if (hostname[i] == '\0') 248 break; 249 hostnamelen = i; 250 inittodr(ntohl(nd->root_time)); 251 return (0); 252 } 253 254 /* 255 * Internal version of mount system call for diskless setup. 256 */ 257 static struct mount * 258 nfs_mountdiskless(path, which, mountflag, sin, args, vpp) 259 char *path; 260 char *which; 261 int mountflag; 262 struct sockaddr_in *sin; 263 struct nfs_args *args; 264 register struct vnode **vpp; 265 { 266 register struct mount *mp; 267 register struct mbuf *m; 268 register int error; 269 270 mp = (struct mount *)malloc((u_long)sizeof(struct mount), 271 M_MOUNT, M_NOWAIT); 272 if (mp == NULL) 273 panic("nfs_mountroot: %s mount malloc", which); 274 mp->mnt_op = &nfs_vfsops; 275 mp->mnt_flag = mountflag; 276 mp->mnt_mounth = NULLVP; 277 278 MGET(m, MT_SONAME, M_DONTWAIT); 279 if (m == NULL) 280 panic("nfs_mountroot: %s mount mbuf", which); 281 bcopy((caddr_t)sin, mtod(m, caddr_t), sin->sin_len); 282 m->m_len = sin->sin_len; 283 nfsargs_ntoh(args); 284 if (error = mountnfs(args, mp, m, which, path, vpp)) 285 panic("nfs_mountroot: mount %s on %s: %d", path, which, error); 286 287 return (mp); 288 } 289 290 /* 291 * Convert the integer fields of the nfs_args structure from net byte order 292 * to host byte order. Called by nfs_mountroot() above. 293 */ 294 void 295 nfsargs_ntoh(nfsp) 296 register struct nfs_args *nfsp; 297 { 298 299 NTOHL(nfsp->sotype); 300 NTOHL(nfsp->proto); 301 NTOHL(nfsp->flags); 302 NTOHL(nfsp->wsize); 303 NTOHL(nfsp->rsize); 304 NTOHL(nfsp->timeo); 305 NTOHL(nfsp->retrans); 306 NTOHL(nfsp->maxgrouplist); 307 NTOHL(nfsp->readahead); 308 NTOHL(nfsp->leaseterm); 309 NTOHL(nfsp->deadthresh); 310 } 311 312 /* 313 * VFS Operations. 314 * 315 * mount system call 316 * It seems a bit dumb to copyinstr() the host and path here and then 317 * bcopy() them in mountnfs(), but I wanted to detect errors before 318 * doing the sockargs() call because sockargs() allocates an mbuf and 319 * an error after that means that I have to release the mbuf. 320 */ 321 /* ARGSUSED */ 322 int 323 nfs_mount(mp, path, data, ndp, p) 324 struct mount *mp; 325 char *path; 326 caddr_t data; 327 struct nameidata *ndp; 328 struct proc *p; 329 { 330 int error; 331 struct nfs_args args; 332 struct mbuf *nam; 333 struct vnode *vp; 334 char pth[MNAMELEN], hst[MNAMELEN]; 335 u_int len; 336 nfsv2fh_t nfh; 337 338 if (error = copyin(data, (caddr_t)&args, sizeof (struct nfs_args))) 339 return (error); 340 if (error = copyin((caddr_t)args.fh, (caddr_t)&nfh, sizeof (nfsv2fh_t))) 341 return (error); 342 if (error = copyinstr(path, pth, MNAMELEN-1, &len)) 343 return (error); 344 bzero(&pth[len], MNAMELEN - len); 345 if (error = copyinstr(args.hostname, hst, MNAMELEN-1, &len)) 346 return (error); 347 bzero(&hst[len], MNAMELEN - len); 348 /* sockargs() call must be after above copyin() calls */ 349 if (error = sockargs(&nam, (caddr_t)args.addr, 350 args.addrlen, MT_SONAME)) 351 return (error); 352 args.fh = &nfh; 353 error = mountnfs(&args, mp, nam, pth, hst, &vp); 354 return (error); 355 } 356 357 /* 358 * Common code for mount and mountroot 359 */ 360 int 361 mountnfs(argp, mp, nam, pth, hst, vpp) 362 register struct nfs_args *argp; 363 register struct mount *mp; 364 struct mbuf *nam; 365 char *pth, *hst; 366 struct vnode **vpp; 367 { 368 register struct nfsmount *nmp; 369 struct nfsnode *np; 370 int error; 371 fsid_t tfsid; 372 373 if (mp->mnt_flag & MNT_UPDATE) { 374 nmp = VFSTONFS(mp); 375 /* update paths, file handles, etc, here XXX */ 376 m_freem(nam); 377 return (0); 378 } else { 379 MALLOC(nmp, struct nfsmount *, sizeof (struct nfsmount), 380 M_NFSMNT, M_WAITOK); 381 bzero((caddr_t)nmp, sizeof (struct nfsmount)); 382 mp->mnt_data = (qaddr_t)nmp; 383 } 384 getnewfsid(mp, MOUNT_NFS); 385 nmp->nm_mountp = mp; 386 nmp->nm_flag = argp->flags; 387 if ((nmp->nm_flag & (NFSMNT_NQNFS | NFSMNT_MYWRITE)) == 388 (NFSMNT_NQNFS | NFSMNT_MYWRITE)) { 389 error = EPERM; 390 goto bad; 391 } 392 if (nmp->nm_flag & NFSMNT_NQNFS) 393 /* 394 * We have to set mnt_maxsymlink to a non-zero value so 395 * that COMPAT_43 routines will know that we are setting 396 * the d_type field in directories (and can zero it for 397 * unsuspecting binaries). 398 */ 399 mp->mnt_maxsymlinklen = 1; 400 nmp->nm_timeo = NFS_TIMEO; 401 nmp->nm_retry = NFS_RETRANS; 402 nmp->nm_wsize = NFS_WSIZE; 403 nmp->nm_rsize = NFS_RSIZE; 404 nmp->nm_numgrps = NFS_MAXGRPS; 405 nmp->nm_readahead = NFS_DEFRAHEAD; 406 nmp->nm_leaseterm = NQ_DEFLEASE; 407 nmp->nm_deadthresh = NQ_DEADTHRESH; 408 nmp->nm_tnext = (struct nfsnode *)nmp; 409 nmp->nm_tprev = (struct nfsnode *)nmp; 410 nmp->nm_inprog = NULLVP; 411 bcopy((caddr_t)argp->fh, (caddr_t)&nmp->nm_fh, sizeof(nfsv2fh_t)); 412 mp->mnt_stat.f_type = MOUNT_NFS; 413 bcopy(hst, mp->mnt_stat.f_mntfromname, MNAMELEN); 414 bcopy(pth, mp->mnt_stat.f_mntonname, MNAMELEN); 415 nmp->nm_nam = nam; 416 417 if ((argp->flags & NFSMNT_TIMEO) && argp->timeo > 0) { 418 nmp->nm_timeo = (argp->timeo * NFS_HZ + 5) / 10; 419 if (nmp->nm_timeo < NFS_MINTIMEO) 420 nmp->nm_timeo = NFS_MINTIMEO; 421 else if (nmp->nm_timeo > NFS_MAXTIMEO) 422 nmp->nm_timeo = NFS_MAXTIMEO; 423 } 424 425 if ((argp->flags & NFSMNT_RETRANS) && argp->retrans > 1) { 426 nmp->nm_retry = argp->retrans; 427 if (nmp->nm_retry > NFS_MAXREXMIT) 428 nmp->nm_retry = NFS_MAXREXMIT; 429 } 430 431 if ((argp->flags & NFSMNT_WSIZE) && argp->wsize > 0) { 432 nmp->nm_wsize = argp->wsize; 433 /* Round down to multiple of blocksize */ 434 nmp->nm_wsize &= ~0x1ff; 435 if (nmp->nm_wsize <= 0) 436 nmp->nm_wsize = 512; 437 else if (nmp->nm_wsize > NFS_MAXDATA) 438 nmp->nm_wsize = NFS_MAXDATA; 439 } 440 if (nmp->nm_wsize > MAXBSIZE) 441 nmp->nm_wsize = MAXBSIZE; 442 443 if ((argp->flags & NFSMNT_RSIZE) && argp->rsize > 0) { 444 nmp->nm_rsize = argp->rsize; 445 /* Round down to multiple of blocksize */ 446 nmp->nm_rsize &= ~0x1ff; 447 if (nmp->nm_rsize <= 0) 448 nmp->nm_rsize = 512; 449 else if (nmp->nm_rsize > NFS_MAXDATA) 450 nmp->nm_rsize = NFS_MAXDATA; 451 } 452 if (nmp->nm_rsize > MAXBSIZE) 453 nmp->nm_rsize = MAXBSIZE; 454 if ((argp->flags & NFSMNT_MAXGRPS) && argp->maxgrouplist >= 0 && 455 argp->maxgrouplist <= NFS_MAXGRPS) 456 nmp->nm_numgrps = argp->maxgrouplist; 457 if ((argp->flags & NFSMNT_READAHEAD) && argp->readahead >= 0 && 458 argp->readahead <= NFS_MAXRAHEAD) 459 nmp->nm_readahead = argp->readahead; 460 if ((argp->flags & NFSMNT_LEASETERM) && argp->leaseterm >= 2 && 461 argp->leaseterm <= NQ_MAXLEASE) 462 nmp->nm_leaseterm = argp->leaseterm; 463 if ((argp->flags & NFSMNT_DEADTHRESH) && argp->deadthresh >= 1 && 464 argp->deadthresh <= NQ_NEVERDEAD) 465 nmp->nm_deadthresh = argp->deadthresh; 466 /* Set up the sockets and per-host congestion */ 467 nmp->nm_sotype = argp->sotype; 468 nmp->nm_soproto = argp->proto; 469 470 /* 471 * For Connection based sockets (TCP,...) defer the connect until 472 * the first request, in case the server is not responding. 473 */ 474 if (nmp->nm_sotype == SOCK_DGRAM && 475 (error = nfs_connect(nmp, (struct nfsreq *)0))) 476 goto bad; 477 478 /* 479 * This is silly, but it has to be set so that vinifod() works. 480 * We do not want to do an nfs_statfs() here since we can get 481 * stuck on a dead server and we are holding a lock on the mount 482 * point. 483 */ 484 mp->mnt_stat.f_iosize = NFS_MAXDGRAMDATA; 485 /* 486 * A reference count is needed on the nfsnode representing the 487 * remote root. If this object is not persistent, then backward 488 * traversals of the mount point (i.e. "..") will not work if 489 * the nfsnode gets flushed out of the cache. Ufs does not have 490 * this problem, because one can identify root inodes by their 491 * number == ROOTINO (2). 492 */ 493 if (error = nfs_nget(mp, &nmp->nm_fh, &np)) 494 goto bad; 495 *vpp = NFSTOV(np); 496 497 return (0); 498 bad: 499 nfs_disconnect(nmp); 500 free((caddr_t)nmp, M_NFSMNT); 501 m_freem(nam); 502 return (error); 503 } 504 505 /* 506 * unmount system call 507 */ 508 int 509 nfs_unmount(mp, mntflags, p) 510 struct mount *mp; 511 int mntflags; 512 struct proc *p; 513 { 514 register struct nfsmount *nmp; 515 struct nfsnode *np; 516 struct vnode *vp; 517 int error, flags = 0; 518 extern int doforce; 519 520 if (mntflags & MNT_FORCE) { 521 if (!doforce || mp == rootfs) 522 return (EINVAL); 523 flags |= FORCECLOSE; 524 } 525 nmp = VFSTONFS(mp); 526 /* 527 * Goes something like this.. 528 * - Check for activity on the root vnode (other than ourselves). 529 * - Call vflush() to clear out vnodes for this file system, 530 * except for the root vnode. 531 * - Decrement reference on the vnode representing remote root. 532 * - Close the socket 533 * - Free up the data structures 534 */ 535 /* 536 * We need to decrement the ref. count on the nfsnode representing 537 * the remote root. See comment in mountnfs(). The VFS unmount() 538 * has done vput on this vnode, otherwise we would get deadlock! 539 */ 540 if (error = nfs_nget(mp, &nmp->nm_fh, &np)) 541 return(error); 542 vp = NFSTOV(np); 543 if (vp->v_usecount > 2) { 544 vput(vp); 545 return (EBUSY); 546 } 547 548 /* 549 * Must handshake with nqnfs_clientd() if it is active. 550 */ 551 nmp->nm_flag |= NFSMNT_DISMINPROG; 552 while (nmp->nm_inprog != NULLVP) 553 (void) tsleep((caddr_t)&lbolt, PSOCK, "nfsdism", 0); 554 if (error = vflush(mp, vp, flags)) { 555 vput(vp); 556 nmp->nm_flag &= ~NFSMNT_DISMINPROG; 557 return (error); 558 } 559 560 /* 561 * We are now committed to the unmount. 562 * For NQNFS, let the server daemon free the nfsmount structure. 563 */ 564 if (nmp->nm_flag & (NFSMNT_NQNFS | NFSMNT_KERB)) 565 nmp->nm_flag |= NFSMNT_DISMNT; 566 567 /* 568 * There are two reference counts to get rid of here. 569 */ 570 vrele(vp); 571 vrele(vp); 572 vgone(vp); 573 nfs_disconnect(nmp); 574 m_freem(nmp->nm_nam); 575 576 if ((nmp->nm_flag & (NFSMNT_NQNFS | NFSMNT_KERB)) == 0) 577 free((caddr_t)nmp, M_NFSMNT); 578 return (0); 579 } 580 581 /* 582 * Return root of a filesystem 583 */ 584 int 585 nfs_root(mp, vpp) 586 struct mount *mp; 587 struct vnode **vpp; 588 { 589 register struct vnode *vp; 590 struct nfsmount *nmp; 591 struct nfsnode *np; 592 int error; 593 594 nmp = VFSTONFS(mp); 595 if (error = nfs_nget(mp, &nmp->nm_fh, &np)) 596 return (error); 597 vp = NFSTOV(np); 598 vp->v_type = VDIR; 599 vp->v_flag = VROOT; 600 *vpp = vp; 601 return (0); 602 } 603 604 extern int syncprt; 605 606 /* 607 * Flush out the buffer cache 608 */ 609 /* ARGSUSED */ 610 int 611 nfs_sync(mp, waitfor, cred, p) 612 struct mount *mp; 613 int waitfor; 614 struct ucred *cred; 615 struct proc *p; 616 { 617 register struct vnode *vp; 618 int error, allerror = 0; 619 620 /* 621 * Force stale buffer cache information to be flushed. 622 */ 623 loop: 624 for (vp = mp->mnt_mounth; vp; vp = vp->v_mountf) { 625 /* 626 * If the vnode that we are about to sync is no longer 627 * associated with this mount point, start over. 628 */ 629 if (vp->v_mount != mp) 630 goto loop; 631 if (VOP_ISLOCKED(vp) || vp->v_dirtyblkhd.le_next == NULL) 632 continue; 633 if (vget(vp)) 634 goto loop; 635 if (error = VOP_FSYNC(vp, cred, waitfor, p)) 636 allerror = error; 637 vput(vp); 638 } 639 return (allerror); 640 } 641 642 /* 643 * NFS flat namespace lookup. 644 * Currently unsupported. 645 */ 646 /* ARGSUSED */ 647 int 648 nfs_vget(mp, ino, vpp) 649 struct mount *mp; 650 ino_t ino; 651 struct vnode **vpp; 652 { 653 654 return (EOPNOTSUPP); 655 } 656 657 /* 658 * At this point, this should never happen 659 */ 660 /* ARGSUSED */ 661 int 662 nfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) 663 register struct mount *mp; 664 struct fid *fhp; 665 struct mbuf *nam; 666 struct vnode **vpp; 667 int *exflagsp; 668 struct ucred **credanonp; 669 { 670 671 return (EINVAL); 672 } 673 674 /* 675 * Vnode pointer to File handle, should never happen either 676 */ 677 /* ARGSUSED */ 678 int 679 nfs_vptofh(vp, fhp) 680 struct vnode *vp; 681 struct fid *fhp; 682 { 683 684 return (EINVAL); 685 } 686 687 /* 688 * Vfs start routine, a no-op. 689 */ 690 /* ARGSUSED */ 691 int 692 nfs_start(mp, flags, p) 693 struct mount *mp; 694 int flags; 695 struct proc *p; 696 { 697 698 return (0); 699 } 700 701 /* 702 * Do operations associated with quotas, not supported 703 */ 704 /* ARGSUSED */ 705 int 706 nfs_quotactl(mp, cmd, uid, arg, p) 707 struct mount *mp; 708 int cmd; 709 uid_t uid; 710 caddr_t arg; 711 struct proc *p; 712 { 713 714 return (EOPNOTSUPP); 715 } 716