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 6 * to Berkeley by John Heidemann of the UCLA Ficus project. 7 * 8 * Source: * @(#)i405_init.c 2.10 92/04/27 UCLA Ficus project 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. All advertising materials mentioning features or use of this software 19 * must display the following acknowledgement: 20 * This product includes software developed by the University of 21 * California, Berkeley and its contributors. 22 * 4. Neither the name of the University nor the names of its contributors 23 * may be used to endorse or promote products derived from this software 24 * without specific prior written permission. 25 * 26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 */ 38 39 #include <sys/cdefs.h> 40 __FBSDID("$FreeBSD$"); 41 42 #include <sys/param.h> 43 #include <sys/systm.h> 44 #include <sys/bio.h> 45 #include <sys/buf.h> 46 #include <sys/conf.h> 47 #include <sys/kernel.h> 48 #include <sys/limits.h> 49 #include <sys/lock.h> 50 #include <sys/malloc.h> 51 #include <sys/mount.h> 52 #include <sys/mutex.h> 53 #include <sys/unistd.h> 54 #include <sys/vnode.h> 55 #include <sys/poll.h> 56 57 #include <vm/vm.h> 58 #include <vm/vm_object.h> 59 #include <vm/vm_extern.h> 60 #include <vm/pmap.h> 61 #include <vm/vm_map.h> 62 #include <vm/vm_page.h> 63 #include <vm/vm_pager.h> 64 #include <vm/vnode_pager.h> 65 66 static int vop_nolookup(struct vop_lookup_args *); 67 static int vop_nostrategy(struct vop_strategy_args *); 68 69 /* 70 * This vnode table stores what we want to do if the filesystem doesn't 71 * implement a particular VOP. 72 * 73 * If there is no specific entry here, we will return EOPNOTSUPP. 74 * 75 */ 76 77 vop_t **default_vnodeop_p; 78 static struct vnodeopv_entry_desc default_vnodeop_entries[] = { 79 { &vop_default_desc, (vop_t *) vop_eopnotsupp }, 80 { &vop_advlock_desc, (vop_t *) vop_einval }, 81 { &vop_bmap_desc, (vop_t *) vop_stdbmap }, 82 { &vop_close_desc, (vop_t *) vop_null }, 83 { &vop_createvobject_desc, (vop_t *) vop_stdcreatevobject }, 84 { &vop_destroyvobject_desc, (vop_t *) vop_stddestroyvobject }, 85 { &vop_fsync_desc, (vop_t *) vop_null }, 86 { &vop_getpages_desc, (vop_t *) vop_stdgetpages }, 87 { &vop_getvobject_desc, (vop_t *) vop_stdgetvobject }, 88 { &vop_inactive_desc, (vop_t *) vop_stdinactive }, 89 { &vop_ioctl_desc, (vop_t *) vop_enotty }, 90 { &vop_islocked_desc, (vop_t *) vop_stdislocked }, 91 { &vop_lease_desc, (vop_t *) vop_null }, 92 { &vop_lock_desc, (vop_t *) vop_stdlock }, 93 { &vop_lookup_desc, (vop_t *) vop_nolookup }, 94 { &vop_open_desc, (vop_t *) vop_null }, 95 { &vop_pathconf_desc, (vop_t *) vop_einval }, 96 { &vop_poll_desc, (vop_t *) vop_nopoll }, 97 { &vop_putpages_desc, (vop_t *) vop_stdputpages }, 98 { &vop_readlink_desc, (vop_t *) vop_einval }, 99 { &vop_revoke_desc, (vop_t *) vop_revoke }, 100 { &vop_specstrategy_desc, (vop_t *) vop_panic }, 101 { &vop_strategy_desc, (vop_t *) vop_nostrategy }, 102 { &vop_unlock_desc, (vop_t *) vop_stdunlock }, 103 { NULL, NULL } 104 }; 105 106 static struct vnodeopv_desc default_vnodeop_opv_desc = 107 { &default_vnodeop_p, default_vnodeop_entries }; 108 109 VNODEOP_SET(default_vnodeop_opv_desc); 110 111 /* 112 * Series of placeholder functions for various error returns for 113 * VOPs. 114 */ 115 116 int 117 vop_eopnotsupp(struct vop_generic_args *ap) 118 { 119 /* 120 printf("vop_notsupp[%s]\n", ap->a_desc->vdesc_name); 121 */ 122 123 return (EOPNOTSUPP); 124 } 125 126 int 127 vop_ebadf(struct vop_generic_args *ap) 128 { 129 130 return (EBADF); 131 } 132 133 int 134 vop_enotty(struct vop_generic_args *ap) 135 { 136 137 return (ENOTTY); 138 } 139 140 int 141 vop_einval(struct vop_generic_args *ap) 142 { 143 144 return (EINVAL); 145 } 146 147 int 148 vop_null(struct vop_generic_args *ap) 149 { 150 151 return (0); 152 } 153 154 /* 155 * Used to make a defined VOP fall back to the default VOP. 156 */ 157 int 158 vop_defaultop(struct vop_generic_args *ap) 159 { 160 161 return (VOCALL(default_vnodeop_p, ap->a_desc->vdesc_offset, ap)); 162 } 163 164 /* 165 * Helper function to panic on some bad VOPs in some filesystems. 166 */ 167 int 168 vop_panic(struct vop_generic_args *ap) 169 { 170 171 panic("filesystem goof: vop_panic[%s]", ap->a_desc->vdesc_name); 172 } 173 174 /* 175 * vop_std<something> and vop_no<something> are default functions for use by 176 * filesystems that need the "default reasonable" implementation for a 177 * particular operation. 178 * 179 * The documentation for the operations they implement exists (if it exists) 180 * in the VOP_<SOMETHING>(9) manpage (all uppercase). 181 */ 182 183 /* 184 * Default vop for filesystems that do not support name lookup 185 */ 186 static int 187 vop_nolookup(ap) 188 struct vop_lookup_args /* { 189 struct vnode *a_dvp; 190 struct vnode **a_vpp; 191 struct componentname *a_cnp; 192 } */ *ap; 193 { 194 195 *ap->a_vpp = NULL; 196 return (ENOTDIR); 197 } 198 199 /* 200 * vop_nostrategy: 201 * 202 * Strategy routine for VFS devices that have none. 203 * 204 * BIO_ERROR and B_INVAL must be cleared prior to calling any strategy 205 * routine. Typically this is done for a BIO_READ strategy call. 206 * Typically B_INVAL is assumed to already be clear prior to a write 207 * and should not be cleared manually unless you just made the buffer 208 * invalid. BIO_ERROR should be cleared either way. 209 */ 210 211 static int 212 vop_nostrategy (struct vop_strategy_args *ap) 213 { 214 KASSERT(ap->a_vp == ap->a_bp->b_vp, ("%s(%p != %p)", 215 __func__, ap->a_vp, ap->a_bp->b_vp)); 216 printf("No strategy for buffer at %p\n", ap->a_bp); 217 vprint("vnode", ap->a_vp); 218 vprint("device vnode", ap->a_bp->b_vp); 219 ap->a_bp->b_ioflags |= BIO_ERROR; 220 ap->a_bp->b_error = EOPNOTSUPP; 221 bufdone(ap->a_bp); 222 return (EOPNOTSUPP); 223 } 224 225 /* 226 * vop_stdpathconf: 227 * 228 * Standard implementation of POSIX pathconf, to get information about limits 229 * for a filesystem. 230 * Override per filesystem for the case where the filesystem has smaller 231 * limits. 232 */ 233 int 234 vop_stdpathconf(ap) 235 struct vop_pathconf_args /* { 236 struct vnode *a_vp; 237 int a_name; 238 int *a_retval; 239 } */ *ap; 240 { 241 242 switch (ap->a_name) { 243 case _PC_LINK_MAX: 244 *ap->a_retval = LINK_MAX; 245 return (0); 246 case _PC_MAX_CANON: 247 *ap->a_retval = MAX_CANON; 248 return (0); 249 case _PC_MAX_INPUT: 250 *ap->a_retval = MAX_INPUT; 251 return (0); 252 case _PC_PIPE_BUF: 253 *ap->a_retval = PIPE_BUF; 254 return (0); 255 case _PC_CHOWN_RESTRICTED: 256 *ap->a_retval = 1; 257 return (0); 258 case _PC_VDISABLE: 259 *ap->a_retval = _POSIX_VDISABLE; 260 return (0); 261 default: 262 return (EINVAL); 263 } 264 /* NOTREACHED */ 265 } 266 267 /* 268 * Standard lock, unlock and islocked functions. 269 */ 270 int 271 vop_stdlock(ap) 272 struct vop_lock_args /* { 273 struct vnode *a_vp; 274 int a_flags; 275 struct thread *a_td; 276 } */ *ap; 277 { 278 struct vnode *vp = ap->a_vp; 279 280 #ifndef DEBUG_LOCKS 281 return (lockmgr(vp->v_vnlock, ap->a_flags, VI_MTX(vp), ap->a_td)); 282 #else 283 return (debuglockmgr(vp->v_vnlock, ap->a_flags, VI_MTX(vp), 284 ap->a_td, "vop_stdlock", vp->filename, vp->line)); 285 #endif 286 } 287 288 /* See above. */ 289 int 290 vop_stdunlock(ap) 291 struct vop_unlock_args /* { 292 struct vnode *a_vp; 293 int a_flags; 294 struct thread *a_td; 295 } */ *ap; 296 { 297 struct vnode *vp = ap->a_vp; 298 299 return (lockmgr(vp->v_vnlock, ap->a_flags | LK_RELEASE, VI_MTX(vp), 300 ap->a_td)); 301 } 302 303 /* See above. */ 304 int 305 vop_stdislocked(ap) 306 struct vop_islocked_args /* { 307 struct vnode *a_vp; 308 struct thread *a_td; 309 } */ *ap; 310 { 311 312 return (lockstatus(ap->a_vp->v_vnlock, ap->a_td)); 313 } 314 315 /* Mark the vnode inactive */ 316 int 317 vop_stdinactive(ap) 318 struct vop_inactive_args /* { 319 struct vnode *a_vp; 320 struct thread *a_td; 321 } */ *ap; 322 { 323 324 VOP_UNLOCK(ap->a_vp, 0, ap->a_td); 325 return (0); 326 } 327 328 /* 329 * Return true for select/poll. 330 */ 331 int 332 vop_nopoll(ap) 333 struct vop_poll_args /* { 334 struct vnode *a_vp; 335 int a_events; 336 struct ucred *a_cred; 337 struct thread *a_td; 338 } */ *ap; 339 { 340 /* 341 * Return true for read/write. If the user asked for something 342 * special, return POLLNVAL, so that clients have a way of 343 * determining reliably whether or not the extended 344 * functionality is present without hard-coding knowledge 345 * of specific filesystem implementations. 346 * Stay in sync with kern_conf.c::no_poll(). 347 */ 348 if (ap->a_events & ~POLLSTANDARD) 349 return (POLLNVAL); 350 351 return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)); 352 } 353 354 /* 355 * Implement poll for local filesystems that support it. 356 */ 357 int 358 vop_stdpoll(ap) 359 struct vop_poll_args /* { 360 struct vnode *a_vp; 361 int a_events; 362 struct ucred *a_cred; 363 struct thread *a_td; 364 } */ *ap; 365 { 366 if (ap->a_events & ~POLLSTANDARD) 367 return (vn_pollrecord(ap->a_vp, ap->a_td, ap->a_events)); 368 return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)); 369 } 370 371 /* 372 * Return our mount point, as we will take charge of the writes. 373 */ 374 int 375 vop_stdgetwritemount(ap) 376 struct vop_getwritemount_args /* { 377 struct vnode *a_vp; 378 struct mount **a_mpp; 379 } */ *ap; 380 { 381 382 *(ap->a_mpp) = ap->a_vp->v_mount; 383 return (0); 384 } 385 386 /* Create the VM system backing object for this vnode */ 387 int 388 vop_stdcreatevobject(ap) 389 struct vop_createvobject_args /* { 390 struct vnode *vp; 391 struct ucred *cred; 392 struct thread *td; 393 } */ *ap; 394 { 395 struct vnode *vp = ap->a_vp; 396 struct ucred *cred = ap->a_cred; 397 struct thread *td = ap->a_td; 398 struct vattr vat; 399 vm_object_t object; 400 int error = 0; 401 402 GIANT_REQUIRED; 403 404 if (!vn_isdisk(vp, NULL) && vn_canvmio(vp) == FALSE) 405 return (0); 406 407 retry: 408 if ((object = vp->v_object) == NULL) { 409 if (vp->v_type == VREG || vp->v_type == VDIR) { 410 if ((error = VOP_GETATTR(vp, &vat, cred, td)) != 0) 411 goto retn; 412 object = vnode_pager_alloc(vp, vat.va_size, 0, 0); 413 } else if (devsw(vp->v_rdev) != NULL) { 414 /* 415 * This simply allocates the biggest object possible 416 * for a disk vnode. This should be fixed, but doesn't 417 * cause any problems (yet). 418 */ 419 object = vnode_pager_alloc(vp, IDX_TO_OFF(INT_MAX), 0, 0); 420 } else { 421 goto retn; 422 } 423 /* 424 * Dereference the reference we just created. This assumes 425 * that the object is associated with the vp. 426 */ 427 VM_OBJECT_LOCK(object); 428 object->ref_count--; 429 VM_OBJECT_UNLOCK(object); 430 vrele(vp); 431 } else { 432 VM_OBJECT_LOCK(object); 433 if (object->flags & OBJ_DEAD) { 434 VOP_UNLOCK(vp, 0, td); 435 msleep(object, VM_OBJECT_MTX(object), PDROP | PVM, 436 "vodead", 0); 437 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); 438 goto retry; 439 } 440 VM_OBJECT_UNLOCK(object); 441 } 442 443 KASSERT(vp->v_object != NULL, ("vfs_object_create: NULL object")); 444 vp->v_vflag |= VV_OBJBUF; 445 446 retn: 447 return (error); 448 } 449 450 /* Destroy the VM system object associated with this vnode */ 451 int 452 vop_stddestroyvobject(ap) 453 struct vop_destroyvobject_args /* { 454 struct vnode *vp; 455 } */ *ap; 456 { 457 struct vnode *vp = ap->a_vp; 458 vm_object_t obj = vp->v_object; 459 460 GIANT_REQUIRED; 461 462 if (obj == NULL) 463 return (0); 464 VM_OBJECT_LOCK(obj); 465 if (obj->ref_count == 0) { 466 /* 467 * vclean() may be called twice. The first time 468 * removes the primary reference to the object, 469 * the second time goes one further and is a 470 * special-case to terminate the object. 471 * 472 * don't double-terminate the object 473 */ 474 if ((obj->flags & OBJ_DEAD) == 0) 475 vm_object_terminate(obj); 476 else 477 VM_OBJECT_UNLOCK(obj); 478 } else { 479 /* 480 * Woe to the process that tries to page now :-). 481 */ 482 vm_pager_deallocate(obj); 483 VM_OBJECT_UNLOCK(obj); 484 } 485 return (0); 486 } 487 488 /* 489 * Return the underlying VM object. This routine may be called with or 490 * without the vnode interlock held. If called without, the returned 491 * object is not guarenteed to be valid. The syncer typically gets the 492 * object without holding the interlock in order to quickly test whether 493 * it might be dirty before going heavy-weight. vm_object's use zalloc 494 * and thus stable-storage, so this is safe. 495 */ 496 int 497 vop_stdgetvobject(ap) 498 struct vop_getvobject_args /* { 499 struct vnode *vp; 500 struct vm_object **objpp; 501 } */ *ap; 502 { 503 struct vnode *vp = ap->a_vp; 504 struct vm_object **objpp = ap->a_objpp; 505 506 if (objpp) 507 *objpp = vp->v_object; 508 return (vp->v_object ? 0 : EINVAL); 509 } 510 511 /* XXX Needs good comment and VOP_BMAP(9) manpage */ 512 int 513 vop_stdbmap(ap) 514 struct vop_bmap_args /* { 515 struct vnode *a_vp; 516 daddr_t a_bn; 517 struct vnode **a_vpp; 518 daddr_t *a_bnp; 519 int *a_runp; 520 int *a_runb; 521 } */ *ap; 522 { 523 524 if (ap->a_vpp != NULL) 525 *ap->a_vpp = ap->a_vp; 526 if (ap->a_bnp != NULL) 527 *ap->a_bnp = ap->a_bn * btodb(ap->a_vp->v_mount->mnt_stat.f_iosize); 528 if (ap->a_runp != NULL) 529 *ap->a_runp = 0; 530 if (ap->a_runb != NULL) 531 *ap->a_runb = 0; 532 return (0); 533 } 534 535 int 536 vop_stdfsync(ap) 537 struct vop_fsync_args /* { 538 struct vnode *a_vp; 539 struct ucred *a_cred; 540 int a_waitfor; 541 struct thread *a_td; 542 } */ *ap; 543 { 544 struct vnode *vp = ap->a_vp; 545 struct buf *bp; 546 struct buf *nbp; 547 int s, error = 0; 548 int maxretry = 100; /* large, arbitrarily chosen */ 549 550 VI_LOCK(vp); 551 loop1: 552 /* 553 * MARK/SCAN initialization to avoid infinite loops. 554 */ 555 s = splbio(); 556 TAILQ_FOREACH(bp, &vp->v_dirtyblkhd, b_vnbufs) { 557 bp->b_vflags &= ~BV_SCANNED; 558 bp->b_error = 0; 559 } 560 splx(s); 561 562 /* 563 * Flush all dirty buffers associated with a block device. 564 */ 565 loop2: 566 s = splbio(); 567 for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp != NULL; bp = nbp) { 568 nbp = TAILQ_NEXT(bp, b_vnbufs); 569 if ((bp->b_vflags & BV_SCANNED) != 0) 570 continue; 571 bp->b_vflags |= BV_SCANNED; 572 if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL)) 573 continue; 574 VI_UNLOCK(vp); 575 if ((bp->b_flags & B_DELWRI) == 0) 576 panic("fsync: not dirty"); 577 if ((vp->v_vflag & VV_OBJBUF) && (bp->b_flags & B_CLUSTEROK)) { 578 vfs_bio_awrite(bp); 579 splx(s); 580 } else { 581 bremfree(bp); 582 splx(s); 583 bawrite(bp); 584 } 585 VI_LOCK(vp); 586 goto loop2; 587 } 588 589 /* 590 * If synchronous the caller expects us to completely resolve all 591 * dirty buffers in the system. Wait for in-progress I/O to 592 * complete (which could include background bitmap writes), then 593 * retry if dirty blocks still exist. 594 */ 595 if (ap->a_waitfor == MNT_WAIT) { 596 while (vp->v_numoutput) { 597 vp->v_iflag |= VI_BWAIT; 598 msleep((caddr_t)&vp->v_numoutput, VI_MTX(vp), 599 PRIBIO + 1, "fsync", 0); 600 } 601 if (!TAILQ_EMPTY(&vp->v_dirtyblkhd)) { 602 /* 603 * If we are unable to write any of these buffers 604 * then we fail now rather than trying endlessly 605 * to write them out. 606 */ 607 TAILQ_FOREACH(bp, &vp->v_dirtyblkhd, b_vnbufs) 608 if ((error = bp->b_error) == 0) 609 continue; 610 if (error == 0 && --maxretry >= 0) { 611 splx(s); 612 goto loop1; 613 } 614 vprint("fsync: giving up on dirty", vp); 615 error = EAGAIN; 616 } 617 } 618 VI_UNLOCK(vp); 619 splx(s); 620 621 return (error); 622 } 623 624 /* XXX Needs good comment and more info in the manpage (VOP_GETPAGES(9)). */ 625 int 626 vop_stdgetpages(ap) 627 struct vop_getpages_args /* { 628 struct vnode *a_vp; 629 vm_page_t *a_m; 630 int a_count; 631 int a_reqpage; 632 vm_ooffset_t a_offset; 633 } */ *ap; 634 { 635 636 return vnode_pager_generic_getpages(ap->a_vp, ap->a_m, 637 ap->a_count, ap->a_reqpage); 638 } 639 640 /* XXX Needs good comment and more info in the manpage (VOP_PUTPAGES(9)). */ 641 int 642 vop_stdputpages(ap) 643 struct vop_putpages_args /* { 644 struct vnode *a_vp; 645 vm_page_t *a_m; 646 int a_count; 647 int a_sync; 648 int *a_rtvals; 649 vm_ooffset_t a_offset; 650 } */ *ap; 651 { 652 653 return vnode_pager_generic_putpages(ap->a_vp, ap->a_m, ap->a_count, 654 ap->a_sync, ap->a_rtvals); 655 } 656 657 /* 658 * vfs default ops 659 * used to fill the vfs function table to get reasonable default return values. 660 */ 661 int 662 vfs_stdroot (mp, vpp) 663 struct mount *mp; 664 struct vnode **vpp; 665 { 666 return (EOPNOTSUPP); 667 } 668 669 int 670 vfs_stdstatfs (mp, sbp, td) 671 struct mount *mp; 672 struct statfs *sbp; 673 struct thread *td; 674 { 675 return (EOPNOTSUPP); 676 } 677 678 int 679 vfs_stdvptofh (vp, fhp) 680 struct vnode *vp; 681 struct fid *fhp; 682 { 683 return (EOPNOTSUPP); 684 } 685 686 int 687 vfs_stdstart (mp, flags, td) 688 struct mount *mp; 689 int flags; 690 struct thread *td; 691 { 692 return (0); 693 } 694 695 int 696 vfs_stdquotactl (mp, cmds, uid, arg, td) 697 struct mount *mp; 698 int cmds; 699 uid_t uid; 700 caddr_t arg; 701 struct thread *td; 702 { 703 return (EOPNOTSUPP); 704 } 705 706 int 707 vfs_stdsync(mp, waitfor, cred, td) 708 struct mount *mp; 709 int waitfor; 710 struct ucred *cred; 711 struct thread *td; 712 { 713 struct vnode *vp, *nvp; 714 int error, lockreq, allerror = 0; 715 716 lockreq = LK_EXCLUSIVE | LK_INTERLOCK; 717 if (waitfor != MNT_WAIT) 718 lockreq |= LK_NOWAIT; 719 /* 720 * Force stale buffer cache information to be flushed. 721 */ 722 MNT_ILOCK(mp); 723 loop: 724 for (vp = TAILQ_FIRST(&mp->mnt_nvnodelist); vp != NULL; vp = nvp) { 725 /* 726 * If the vnode that we are about to sync is no longer 727 * associated with this mount point, start over. 728 */ 729 if (vp->v_mount != mp) 730 goto loop; 731 732 nvp = TAILQ_NEXT(vp, v_nmntvnodes); 733 734 VI_LOCK(vp); 735 if (TAILQ_EMPTY(&vp->v_dirtyblkhd)) { 736 VI_UNLOCK(vp); 737 continue; 738 } 739 MNT_IUNLOCK(mp); 740 741 if ((error = vget(vp, lockreq, td)) != 0) { 742 MNT_ILOCK(mp); 743 if (error == ENOENT) 744 goto loop; 745 continue; 746 } 747 error = VOP_FSYNC(vp, cred, waitfor, td); 748 if (error) 749 allerror = error; 750 751 VOP_UNLOCK(vp, 0, td); 752 vrele(vp); 753 MNT_ILOCK(mp); 754 } 755 MNT_IUNLOCK(mp); 756 return (allerror); 757 } 758 759 int 760 vfs_stdnosync (mp, waitfor, cred, td) 761 struct mount *mp; 762 int waitfor; 763 struct ucred *cred; 764 struct thread *td; 765 { 766 return (0); 767 } 768 769 int 770 vfs_stdvget (mp, ino, flags, vpp) 771 struct mount *mp; 772 ino_t ino; 773 int flags; 774 struct vnode **vpp; 775 { 776 return (EOPNOTSUPP); 777 } 778 779 int 780 vfs_stdfhtovp (mp, fhp, vpp) 781 struct mount *mp; 782 struct fid *fhp; 783 struct vnode **vpp; 784 { 785 return (EOPNOTSUPP); 786 } 787 788 int 789 vfs_stdinit (vfsp) 790 struct vfsconf *vfsp; 791 { 792 return (0); 793 } 794 795 int 796 vfs_stduninit (vfsp) 797 struct vfsconf *vfsp; 798 { 799 return(0); 800 } 801 802 int 803 vfs_stdextattrctl(mp, cmd, filename_vp, attrnamespace, attrname, td) 804 struct mount *mp; 805 int cmd; 806 struct vnode *filename_vp; 807 int attrnamespace; 808 const char *attrname; 809 struct thread *td; 810 { 811 if (filename_vp != NULL) 812 VOP_UNLOCK(filename_vp, 0, td); 813 return(EOPNOTSUPP); 814 } 815 816 /* end of vfs default ops */ 817