1 /* 2 * Copyright (c) 1989 The Regents of the University of California. 3 * 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 7.50 (Berkeley) 04/08/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_RDIRALOOK | NFSMNT_LEASETERM)) { 393 if ((nmp->nm_flag & NFSMNT_NQNFS) == 0) { 394 error = EPERM; 395 goto bad; 396 } 397 /* 398 * We have to set mnt_maxsymlink to a non-zero value so 399 * that COMPAT_43 routines will know that we are setting 400 * the d_type field in directories (and can zero it for 401 * unsuspecting binaries). 402 */ 403 mp->mnt_maxsymlinklen = 1; 404 } 405 nmp->nm_timeo = NFS_TIMEO; 406 nmp->nm_retry = NFS_RETRANS; 407 nmp->nm_wsize = NFS_WSIZE; 408 nmp->nm_rsize = NFS_RSIZE; 409 nmp->nm_numgrps = NFS_MAXGRPS; 410 nmp->nm_readahead = NFS_DEFRAHEAD; 411 nmp->nm_leaseterm = NQ_DEFLEASE; 412 nmp->nm_deadthresh = NQ_DEADTHRESH; 413 nmp->nm_tnext = (struct nfsnode *)nmp; 414 nmp->nm_tprev = (struct nfsnode *)nmp; 415 nmp->nm_inprog = NULLVP; 416 bcopy((caddr_t)argp->fh, (caddr_t)&nmp->nm_fh, sizeof(nfsv2fh_t)); 417 mp->mnt_stat.f_type = MOUNT_NFS; 418 bcopy(hst, mp->mnt_stat.f_mntfromname, MNAMELEN); 419 bcopy(pth, mp->mnt_stat.f_mntonname, MNAMELEN); 420 nmp->nm_nam = nam; 421 422 if ((argp->flags & NFSMNT_TIMEO) && argp->timeo > 0) { 423 nmp->nm_timeo = (argp->timeo * NFS_HZ + 5) / 10; 424 if (nmp->nm_timeo < NFS_MINTIMEO) 425 nmp->nm_timeo = NFS_MINTIMEO; 426 else if (nmp->nm_timeo > NFS_MAXTIMEO) 427 nmp->nm_timeo = NFS_MAXTIMEO; 428 } 429 430 if ((argp->flags & NFSMNT_RETRANS) && argp->retrans > 1) { 431 nmp->nm_retry = argp->retrans; 432 if (nmp->nm_retry > NFS_MAXREXMIT) 433 nmp->nm_retry = NFS_MAXREXMIT; 434 } 435 436 if ((argp->flags & NFSMNT_WSIZE) && argp->wsize > 0) { 437 nmp->nm_wsize = argp->wsize; 438 /* Round down to multiple of blocksize */ 439 nmp->nm_wsize &= ~0x1ff; 440 if (nmp->nm_wsize <= 0) 441 nmp->nm_wsize = 512; 442 else if (nmp->nm_wsize > NFS_MAXDATA) 443 nmp->nm_wsize = NFS_MAXDATA; 444 } 445 if (nmp->nm_wsize > MAXBSIZE) 446 nmp->nm_wsize = MAXBSIZE; 447 448 if ((argp->flags & NFSMNT_RSIZE) && argp->rsize > 0) { 449 nmp->nm_rsize = argp->rsize; 450 /* Round down to multiple of blocksize */ 451 nmp->nm_rsize &= ~0x1ff; 452 if (nmp->nm_rsize <= 0) 453 nmp->nm_rsize = 512; 454 else if (nmp->nm_rsize > NFS_MAXDATA) 455 nmp->nm_rsize = NFS_MAXDATA; 456 } 457 if (nmp->nm_rsize > MAXBSIZE) 458 nmp->nm_rsize = MAXBSIZE; 459 if ((argp->flags & NFSMNT_MAXGRPS) && argp->maxgrouplist >= 0 && 460 argp->maxgrouplist <= NFS_MAXGRPS) 461 nmp->nm_numgrps = argp->maxgrouplist; 462 if ((argp->flags & NFSMNT_READAHEAD) && argp->readahead >= 0 && 463 argp->readahead <= NFS_MAXRAHEAD) 464 nmp->nm_readahead = argp->readahead; 465 if ((argp->flags & NFSMNT_LEASETERM) && argp->leaseterm >= 2 && 466 argp->leaseterm <= NQ_MAXLEASE) 467 nmp->nm_leaseterm = argp->leaseterm; 468 if ((argp->flags & NFSMNT_DEADTHRESH) && argp->deadthresh >= 1 && 469 argp->deadthresh <= NQ_NEVERDEAD) 470 nmp->nm_deadthresh = argp->deadthresh; 471 /* Set up the sockets and per-host congestion */ 472 nmp->nm_sotype = argp->sotype; 473 nmp->nm_soproto = argp->proto; 474 475 /* 476 * For Connection based sockets (TCP,...) defer the connect until 477 * the first request, in case the server is not responding. 478 */ 479 if (nmp->nm_sotype == SOCK_DGRAM && 480 (error = nfs_connect(nmp, (struct nfsreq *)0))) 481 goto bad; 482 483 /* 484 * This is silly, but it has to be set so that vinifod() works. 485 * We do not want to do an nfs_statfs() here since we can get 486 * stuck on a dead server and we are holding a lock on the mount 487 * point. 488 */ 489 mp->mnt_stat.f_iosize = NFS_MAXDGRAMDATA; 490 /* 491 * A reference count is needed on the nfsnode representing the 492 * remote root. If this object is not persistent, then backward 493 * traversals of the mount point (i.e. "..") will not work if 494 * the nfsnode gets flushed out of the cache. Ufs does not have 495 * this problem, because one can identify root inodes by their 496 * number == ROOTINO (2). 497 */ 498 if (error = nfs_nget(mp, &nmp->nm_fh, &np)) 499 goto bad; 500 *vpp = NFSTOV(np); 501 502 return (0); 503 bad: 504 nfs_disconnect(nmp); 505 free((caddr_t)nmp, M_NFSMNT); 506 m_freem(nam); 507 return (error); 508 } 509 510 /* 511 * unmount system call 512 */ 513 int 514 nfs_unmount(mp, mntflags, p) 515 struct mount *mp; 516 int mntflags; 517 struct proc *p; 518 { 519 register struct nfsmount *nmp; 520 struct nfsnode *np; 521 struct vnode *vp; 522 int error, flags = 0; 523 extern int doforce; 524 525 if (mntflags & MNT_FORCE) { 526 if (!doforce || mp == rootfs) 527 return (EINVAL); 528 flags |= FORCECLOSE; 529 } 530 nmp = VFSTONFS(mp); 531 /* 532 * Goes something like this.. 533 * - Check for activity on the root vnode (other than ourselves). 534 * - Call vflush() to clear out vnodes for this file system, 535 * except for the root vnode. 536 * - Decrement reference on the vnode representing remote root. 537 * - Close the socket 538 * - Free up the data structures 539 */ 540 /* 541 * We need to decrement the ref. count on the nfsnode representing 542 * the remote root. See comment in mountnfs(). The VFS unmount() 543 * has done vput on this vnode, otherwise we would get deadlock! 544 */ 545 if (error = nfs_nget(mp, &nmp->nm_fh, &np)) 546 return(error); 547 vp = NFSTOV(np); 548 if (vp->v_usecount > 2) { 549 vput(vp); 550 return (EBUSY); 551 } 552 553 /* 554 * Must handshake with nqnfs_clientd() if it is active. 555 */ 556 nmp->nm_flag |= NFSMNT_DISMINPROG; 557 while (nmp->nm_inprog != NULLVP) 558 (void) tsleep((caddr_t)&lbolt, PSOCK, "nfsdism", 0); 559 if (error = vflush(mp, vp, flags)) { 560 vput(vp); 561 nmp->nm_flag &= ~NFSMNT_DISMINPROG; 562 return (error); 563 } 564 565 /* 566 * We are now committed to the unmount. 567 * For NQNFS, let the server daemon free the nfsmount structure. 568 */ 569 if (nmp->nm_flag & (NFSMNT_NQNFS | NFSMNT_KERB)) 570 nmp->nm_flag |= NFSMNT_DISMNT; 571 572 /* 573 * There are two reference counts to get rid of here. 574 */ 575 vrele(vp); 576 vrele(vp); 577 vgone(vp); 578 nfs_disconnect(nmp); 579 m_freem(nmp->nm_nam); 580 581 if ((nmp->nm_flag & (NFSMNT_NQNFS | NFSMNT_KERB)) == 0) 582 free((caddr_t)nmp, M_NFSMNT); 583 return (0); 584 } 585 586 /* 587 * Return root of a filesystem 588 */ 589 int 590 nfs_root(mp, vpp) 591 struct mount *mp; 592 struct vnode **vpp; 593 { 594 register struct vnode *vp; 595 struct nfsmount *nmp; 596 struct nfsnode *np; 597 int error; 598 599 nmp = VFSTONFS(mp); 600 if (error = nfs_nget(mp, &nmp->nm_fh, &np)) 601 return (error); 602 vp = NFSTOV(np); 603 vp->v_type = VDIR; 604 vp->v_flag = VROOT; 605 *vpp = vp; 606 return (0); 607 } 608 609 extern int syncprt; 610 611 /* 612 * Flush out the buffer cache 613 */ 614 /* ARGSUSED */ 615 int 616 nfs_sync(mp, waitfor, cred, p) 617 struct mount *mp; 618 int waitfor; 619 struct ucred *cred; 620 struct proc *p; 621 { 622 register struct vnode *vp; 623 int error, allerror = 0; 624 625 /* 626 * Force stale buffer cache information to be flushed. 627 */ 628 loop: 629 for (vp = mp->mnt_mounth; vp; vp = vp->v_mountf) { 630 /* 631 * If the vnode that we are about to sync is no longer 632 * associated with this mount point, start over. 633 */ 634 if (vp->v_mount != mp) 635 goto loop; 636 if (VOP_ISLOCKED(vp) || vp->v_dirtyblkhd.le_next == NULL) 637 continue; 638 if (vget(vp)) 639 goto loop; 640 if (error = VOP_FSYNC(vp, cred, waitfor, p)) 641 allerror = error; 642 vput(vp); 643 } 644 return (allerror); 645 } 646 647 /* 648 * NFS flat namespace lookup. 649 * Currently unsupported. 650 */ 651 /* ARGSUSED */ 652 int 653 nfs_vget(mp, ino, vpp) 654 struct mount *mp; 655 ino_t ino; 656 struct vnode **vpp; 657 { 658 659 return (EOPNOTSUPP); 660 } 661 662 /* 663 * At this point, this should never happen 664 */ 665 /* ARGSUSED */ 666 int 667 nfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) 668 register struct mount *mp; 669 struct fid *fhp; 670 struct mbuf *nam; 671 struct vnode **vpp; 672 int *exflagsp; 673 struct ucred **credanonp; 674 { 675 676 return (EINVAL); 677 } 678 679 /* 680 * Vnode pointer to File handle, should never happen either 681 */ 682 /* ARGSUSED */ 683 int 684 nfs_vptofh(vp, fhp) 685 struct vnode *vp; 686 struct fid *fhp; 687 { 688 689 return (EINVAL); 690 } 691 692 /* 693 * Vfs start routine, a no-op. 694 */ 695 /* ARGSUSED */ 696 int 697 nfs_start(mp, flags, p) 698 struct mount *mp; 699 int flags; 700 struct proc *p; 701 { 702 703 return (0); 704 } 705 706 /* 707 * Do operations associated with quotas, not supported 708 */ 709 /* ARGSUSED */ 710 int 711 nfs_quotactl(mp, cmd, uid, arg, p) 712 struct mount *mp; 713 int cmd; 714 uid_t uid; 715 caddr_t arg; 716 struct proc *p; 717 { 718 719 return (EOPNOTSUPP); 720 } 721