vfs_default.c revision 145732
1139804Simp/*- 230489Sphk * Copyright (c) 1989, 1993 330489Sphk * The Regents of the University of California. All rights reserved. 430489Sphk * 530489Sphk * This code is derived from software contributed 630489Sphk * to Berkeley by John Heidemann of the UCLA Ficus project. 730489Sphk * 830489Sphk * Source: * @(#)i405_init.c 2.10 92/04/27 UCLA Ficus project 930489Sphk * 1030489Sphk * Redistribution and use in source and binary forms, with or without 1130489Sphk * modification, are permitted provided that the following conditions 1230489Sphk * are met: 1330489Sphk * 1. Redistributions of source code must retain the above copyright 1430489Sphk * notice, this list of conditions and the following disclaimer. 1530489Sphk * 2. Redistributions in binary form must reproduce the above copyright 1630489Sphk * notice, this list of conditions and the following disclaimer in the 1730489Sphk * documentation and/or other materials provided with the distribution. 1830489Sphk * 4. Neither the name of the University nor the names of its contributors 1930489Sphk * may be used to endorse or promote products derived from this software 2030489Sphk * without specific prior written permission. 2130489Sphk * 2230489Sphk * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2330489Sphk * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2430489Sphk * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2530489Sphk * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2630489Sphk * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2730489Sphk * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2830489Sphk * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2930489Sphk * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3030489Sphk * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3130489Sphk * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3230489Sphk * SUCH DAMAGE. 3330489Sphk */ 3430489Sphk 35116182Sobrien#include <sys/cdefs.h> 36116182Sobrien__FBSDID("$FreeBSD: head/sys/kern/vfs_default.c 145732 2005-05-01 00:59:34Z jeff $"); 37116182Sobrien 3830489Sphk#include <sys/param.h> 3930489Sphk#include <sys/systm.h> 4060041Sphk#include <sys/bio.h> 4144272Sbde#include <sys/buf.h> 4265770Sbp#include <sys/conf.h> 4330489Sphk#include <sys/kernel.h> 44114216Skan#include <sys/limits.h> 4531561Sbde#include <sys/lock.h> 4630743Sphk#include <sys/malloc.h> 4751068Salfred#include <sys/mount.h> 4867365Sjhb#include <sys/mutex.h> 4930492Sphk#include <sys/unistd.h> 5030489Sphk#include <sys/vnode.h> 5130743Sphk#include <sys/poll.h> 5230489Sphk 5365770Sbp#include <vm/vm.h> 5465770Sbp#include <vm/vm_object.h> 5565770Sbp#include <vm/vm_extern.h> 5665770Sbp#include <vm/pmap.h> 5765770Sbp#include <vm/vm_map.h> 5865770Sbp#include <vm/vm_page.h> 5965770Sbp#include <vm/vm_pager.h> 6065770Sbp#include <vm/vnode_pager.h> 6165770Sbp 6292723Salfredstatic int vop_nolookup(struct vop_lookup_args *); 6392723Salfredstatic int vop_nostrategy(struct vop_strategy_args *); 6430489Sphk 6530489Sphk/* 6630489Sphk * This vnode table stores what we want to do if the filesystem doesn't 6730489Sphk * implement a particular VOP. 6830489Sphk * 6930489Sphk * If there is no specific entry here, we will return EOPNOTSUPP. 7030489Sphk * 7130489Sphk */ 7230489Sphk 73138290Sphkstruct vop_vector default_vnodeops = { 74138290Sphk .vop_default = NULL, 75138339Sphk .vop_bypass = VOP_EOPNOTSUPP, 76138339Sphk 77138290Sphk .vop_advlock = VOP_EINVAL, 78138290Sphk .vop_bmap = vop_stdbmap, 79138290Sphk .vop_close = VOP_NULL, 80138290Sphk .vop_fsync = VOP_NULL, 81138290Sphk .vop_getpages = vop_stdgetpages, 82138290Sphk .vop_getwritemount = vop_stdgetwritemount, 83143494Sjeff .vop_inactive = VOP_NULL, 84138290Sphk .vop_ioctl = VOP_ENOTTY, 85138290Sphk .vop_islocked = vop_stdislocked, 86138290Sphk .vop_lease = VOP_NULL, 87138290Sphk .vop_lock = vop_stdlock, 88138290Sphk .vop_lookup = vop_nolookup, 89138290Sphk .vop_open = VOP_NULL, 90138290Sphk .vop_pathconf = VOP_EINVAL, 91138290Sphk .vop_poll = vop_nopoll, 92138290Sphk .vop_putpages = vop_stdputpages, 93138290Sphk .vop_readlink = VOP_EINVAL, 94138290Sphk .vop_revoke = VOP_PANIC, 95138290Sphk .vop_strategy = vop_nostrategy, 96138290Sphk .vop_unlock = vop_stdunlock, 9730489Sphk}; 9830489Sphk 9991690Seivind/* 10091690Seivind * Series of placeholder functions for various error returns for 10191690Seivind * VOPs. 10291690Seivind */ 10391690Seivind 10430489Sphkint 10530492Sphkvop_eopnotsupp(struct vop_generic_args *ap) 10630489Sphk{ 10730489Sphk /* 10830492Sphk printf("vop_notsupp[%s]\n", ap->a_desc->vdesc_name); 10930489Sphk */ 11030489Sphk 11130489Sphk return (EOPNOTSUPP); 11230489Sphk} 11330489Sphk 11430489Sphkint 11530492Sphkvop_ebadf(struct vop_generic_args *ap) 11630489Sphk{ 11730489Sphk 11830492Sphk return (EBADF); 11930492Sphk} 12030492Sphk 12130492Sphkint 12230492Sphkvop_enotty(struct vop_generic_args *ap) 12330492Sphk{ 12430492Sphk 12530492Sphk return (ENOTTY); 12630492Sphk} 12730492Sphk 12830492Sphkint 12930492Sphkvop_einval(struct vop_generic_args *ap) 13030492Sphk{ 13130492Sphk 13230492Sphk return (EINVAL); 13330492Sphk} 13430492Sphk 13530492Sphkint 13630492Sphkvop_null(struct vop_generic_args *ap) 13730492Sphk{ 13830492Sphk 13930492Sphk return (0); 14030492Sphk} 14130492Sphk 14291690Seivind/* 14391690Seivind * Helper function to panic on some bad VOPs in some filesystems. 14491690Seivind */ 14541056Speterint 14641056Spetervop_panic(struct vop_generic_args *ap) 14741056Speter{ 14841056Speter 14972594Sbde panic("filesystem goof: vop_panic[%s]", ap->a_desc->vdesc_name); 15041056Speter} 15141056Speter 15291690Seivind/* 15391690Seivind * vop_std<something> and vop_no<something> are default functions for use by 15491690Seivind * filesystems that need the "default reasonable" implementation for a 15591690Seivind * particular operation. 15691690Seivind * 15791690Seivind * The documentation for the operations they implement exists (if it exists) 15891690Seivind * in the VOP_<SOMETHING>(9) manpage (all uppercase). 15991690Seivind */ 16091690Seivind 16191690Seivind/* 16291690Seivind * Default vop for filesystems that do not support name lookup 16391690Seivind */ 16472594Sbdestatic int 16572594Sbdevop_nolookup(ap) 16672594Sbde struct vop_lookup_args /* { 16772594Sbde struct vnode *a_dvp; 16872594Sbde struct vnode **a_vpp; 16972594Sbde struct componentname *a_cnp; 17072594Sbde } */ *ap; 17172594Sbde{ 17272594Sbde 17372594Sbde *ap->a_vpp = NULL; 17472594Sbde return (ENOTDIR); 17572594Sbde} 17672594Sbde 17746349Salc/* 17846349Salc * vop_nostrategy: 17946349Salc * 18046349Salc * Strategy routine for VFS devices that have none. 18146349Salc * 18258934Sphk * BIO_ERROR and B_INVAL must be cleared prior to calling any strategy 18358345Sphk * routine. Typically this is done for a BIO_READ strategy call. 184112067Skan * Typically B_INVAL is assumed to already be clear prior to a write 18558345Sphk * and should not be cleared manually unless you just made the buffer 18658934Sphk * invalid. BIO_ERROR should be cleared either way. 18746349Salc */ 18846349Salc 18930489Sphkstatic int 19030489Sphkvop_nostrategy (struct vop_strategy_args *ap) 19130489Sphk{ 19230489Sphk printf("No strategy for buffer at %p\n", ap->a_bp); 193111842Snjl vprint("vnode", ap->a_vp); 19458934Sphk ap->a_bp->b_ioflags |= BIO_ERROR; 19530489Sphk ap->a_bp->b_error = EOPNOTSUPP; 19659249Sphk bufdone(ap->a_bp); 19730489Sphk return (EOPNOTSUPP); 19830489Sphk} 19930492Sphk 20091690Seivind/* 20191690Seivind * vop_stdpathconf: 202112067Skan * 20391690Seivind * Standard implementation of POSIX pathconf, to get information about limits 20491690Seivind * for a filesystem. 20591690Seivind * Override per filesystem for the case where the filesystem has smaller 20691690Seivind * limits. 20791690Seivind */ 20830492Sphkint 20930492Sphkvop_stdpathconf(ap) 21030492Sphk struct vop_pathconf_args /* { 21130492Sphk struct vnode *a_vp; 21230492Sphk int a_name; 21330492Sphk int *a_retval; 21430492Sphk } */ *ap; 21530492Sphk{ 21630492Sphk 21730492Sphk switch (ap->a_name) { 21830492Sphk case _PC_LINK_MAX: 21930492Sphk *ap->a_retval = LINK_MAX; 22030492Sphk return (0); 22130492Sphk case _PC_MAX_CANON: 22230492Sphk *ap->a_retval = MAX_CANON; 22330492Sphk return (0); 22430492Sphk case _PC_MAX_INPUT: 22530492Sphk *ap->a_retval = MAX_INPUT; 22630492Sphk return (0); 22730492Sphk case _PC_PIPE_BUF: 22830492Sphk *ap->a_retval = PIPE_BUF; 22930492Sphk return (0); 23030492Sphk case _PC_CHOWN_RESTRICTED: 23130492Sphk *ap->a_retval = 1; 23230492Sphk return (0); 23330492Sphk case _PC_VDISABLE: 23430492Sphk *ap->a_retval = _POSIX_VDISABLE; 23530492Sphk return (0); 23630492Sphk default: 23730492Sphk return (EINVAL); 23830492Sphk } 23930492Sphk /* NOTREACHED */ 24030492Sphk} 24130513Sphk 24230513Sphk/* 24330513Sphk * Standard lock, unlock and islocked functions. 24430513Sphk */ 24530513Sphkint 24630513Sphkvop_stdlock(ap) 24730513Sphk struct vop_lock_args /* { 24830513Sphk struct vnode *a_vp; 24930513Sphk int a_flags; 25083366Sjulian struct thread *a_td; 25130513Sphk } */ *ap; 252112067Skan{ 25366355Sbp struct vnode *vp = ap->a_vp; 25430513Sphk 25542900Seivind#ifndef DEBUG_LOCKS 256105077Smckusick return (lockmgr(vp->v_vnlock, ap->a_flags, VI_MTX(vp), ap->a_td)); 25742900Seivind#else 258105077Smckusick return (debuglockmgr(vp->v_vnlock, ap->a_flags, VI_MTX(vp), 25983366Sjulian ap->a_td, "vop_stdlock", vp->filename, vp->line)); 26042900Seivind#endif 26130513Sphk} 26230513Sphk 26391690Seivind/* See above. */ 26430513Sphkint 26530513Sphkvop_stdunlock(ap) 26630513Sphk struct vop_unlock_args /* { 26730513Sphk struct vnode *a_vp; 26830513Sphk int a_flags; 26983366Sjulian struct thread *a_td; 27030513Sphk } */ *ap; 27130513Sphk{ 27266355Sbp struct vnode *vp = ap->a_vp; 27330513Sphk 274105077Smckusick return (lockmgr(vp->v_vnlock, ap->a_flags | LK_RELEASE, VI_MTX(vp), 27583366Sjulian ap->a_td)); 27630513Sphk} 27730513Sphk 27891690Seivind/* See above. */ 27930513Sphkint 28030513Sphkvop_stdislocked(ap) 28130513Sphk struct vop_islocked_args /* { 28230513Sphk struct vnode *a_vp; 28383366Sjulian struct thread *a_td; 28430513Sphk } */ *ap; 28530513Sphk{ 28630513Sphk 287105077Smckusick return (lockstatus(ap->a_vp->v_vnlock, ap->a_td)); 28830513Sphk} 28930513Sphk 29030743Sphk/* 29130743Sphk * Return true for select/poll. 29230743Sphk */ 29330743Sphkint 29430743Sphkvop_nopoll(ap) 29530743Sphk struct vop_poll_args /* { 29630743Sphk struct vnode *a_vp; 29730743Sphk int a_events; 29830743Sphk struct ucred *a_cred; 29983366Sjulian struct thread *a_td; 30030743Sphk } */ *ap; 30130743Sphk{ 30230743Sphk /* 30331727Swollman * Return true for read/write. If the user asked for something 30431727Swollman * special, return POLLNVAL, so that clients have a way of 30531727Swollman * determining reliably whether or not the extended 30631727Swollman * functionality is present without hard-coding knowledge 30731727Swollman * of specific filesystem implementations. 308120514Sphk * Stay in sync with kern_conf.c::no_poll(). 30930743Sphk */ 31031727Swollman if (ap->a_events & ~POLLSTANDARD) 31131727Swollman return (POLLNVAL); 31231727Swollman 31330743Sphk return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)); 31430743Sphk} 31530743Sphk 31631727Swollman/* 31731727Swollman * Implement poll for local filesystems that support it. 31831727Swollman */ 31930743Sphkint 32031727Swollmanvop_stdpoll(ap) 32131727Swollman struct vop_poll_args /* { 32231727Swollman struct vnode *a_vp; 32331727Swollman int a_events; 32431727Swollman struct ucred *a_cred; 32583366Sjulian struct thread *a_td; 32631727Swollman } */ *ap; 32731727Swollman{ 32876578Sjlemon if (ap->a_events & ~POLLSTANDARD) 32983366Sjulian return (vn_pollrecord(ap->a_vp, ap->a_td, ap->a_events)); 33076578Sjlemon return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)); 33131727Swollman} 33231727Swollman 33330743Sphk/* 33462976Smckusick * Return our mount point, as we will take charge of the writes. 33562976Smckusick */ 33662976Smckusickint 33762976Smckusickvop_stdgetwritemount(ap) 33862976Smckusick struct vop_getwritemount_args /* { 33962976Smckusick struct vnode *a_vp; 34062976Smckusick struct mount **a_mpp; 34162976Smckusick } */ *ap; 34262976Smckusick{ 34362976Smckusick 34462976Smckusick *(ap->a_mpp) = ap->a_vp->v_mount; 34562976Smckusick return (0); 34662976Smckusick} 34762976Smckusick 34891690Seivind/* XXX Needs good comment and VOP_BMAP(9) manpage */ 34976131Sphkint 35076131Sphkvop_stdbmap(ap) 351112067Skan struct vop_bmap_args /* { 35276131Sphk struct vnode *a_vp; 35376131Sphk daddr_t a_bn; 354137726Sphk struct bufobj **a_bop; 35576131Sphk daddr_t *a_bnp; 35676131Sphk int *a_runp; 35776131Sphk int *a_runb; 35876131Sphk } */ *ap; 35976131Sphk{ 36076131Sphk 361137726Sphk if (ap->a_bop != NULL) 362137726Sphk *ap->a_bop = &ap->a_vp->v_bufobj; 36376131Sphk if (ap->a_bnp != NULL) 36476131Sphk *ap->a_bnp = ap->a_bn * btodb(ap->a_vp->v_mount->mnt_stat.f_iosize); 36576131Sphk if (ap->a_runp != NULL) 36676131Sphk *ap->a_runp = 0; 36776131Sphk if (ap->a_runb != NULL) 36876131Sphk *ap->a_runb = 0; 36976131Sphk return (0); 37076131Sphk} 37176131Sphk 372110584Sjeffint 373110584Sjeffvop_stdfsync(ap) 374110584Sjeff struct vop_fsync_args /* { 375110584Sjeff struct vnode *a_vp; 376110584Sjeff struct ucred *a_cred; 377110584Sjeff int a_waitfor; 378110584Sjeff struct thread *a_td; 379110584Sjeff } */ *ap; 380110584Sjeff{ 381110584Sjeff struct vnode *vp = ap->a_vp; 382110584Sjeff struct buf *bp; 383136751Sphk struct bufobj *bo; 384110584Sjeff struct buf *nbp; 385145732Sjeff int error = 0; 386144584Sjeff int maxretry = 1000; /* large, arbitrarily chosen */ 387110584Sjeff 388110584Sjeff VI_LOCK(vp); 389110584Sjeffloop1: 390110584Sjeff /* 391110584Sjeff * MARK/SCAN initialization to avoid infinite loops. 392110584Sjeff */ 393136943Sphk TAILQ_FOREACH(bp, &vp->v_bufobj.bo_dirty.bv_hd, b_bobufs) { 394110584Sjeff bp->b_vflags &= ~BV_SCANNED; 395110584Sjeff bp->b_error = 0; 396110584Sjeff } 397110584Sjeff 398110584Sjeff /* 399144584Sjeff * Flush all dirty buffers associated with a vnode. 400110584Sjeff */ 401110584Sjeffloop2: 402136943Sphk TAILQ_FOREACH_SAFE(bp, &vp->v_bufobj.bo_dirty.bv_hd, b_bobufs, nbp) { 403110584Sjeff if ((bp->b_vflags & BV_SCANNED) != 0) 404110584Sjeff continue; 405110584Sjeff bp->b_vflags |= BV_SCANNED; 406111463Sjeff if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL)) 407110584Sjeff continue; 408110584Sjeff VI_UNLOCK(vp); 409110584Sjeff if ((bp->b_flags & B_DELWRI) == 0) 410110588Sjeff panic("fsync: not dirty"); 411140734Sphk if ((vp->v_object != NULL) && (bp->b_flags & B_CLUSTEROK)) { 412110584Sjeff vfs_bio_awrite(bp); 413110584Sjeff } else { 414110584Sjeff bremfree(bp); 415110584Sjeff bawrite(bp); 416110584Sjeff } 417110584Sjeff VI_LOCK(vp); 418110584Sjeff goto loop2; 419110584Sjeff } 420110584Sjeff 421110584Sjeff /* 422110584Sjeff * If synchronous the caller expects us to completely resolve all 423110584Sjeff * dirty buffers in the system. Wait for in-progress I/O to 424110584Sjeff * complete (which could include background bitmap writes), then 425110584Sjeff * retry if dirty blocks still exist. 426110584Sjeff */ 427110584Sjeff if (ap->a_waitfor == MNT_WAIT) { 428136751Sphk bo = &vp->v_bufobj; 429136751Sphk bufobj_wwait(bo, 0, 0); 430136751Sphk if (bo->bo_dirty.bv_cnt > 0) { 431110584Sjeff /* 432110584Sjeff * If we are unable to write any of these buffers 433110584Sjeff * then we fail now rather than trying endlessly 434110584Sjeff * to write them out. 435110584Sjeff */ 436136751Sphk TAILQ_FOREACH(bp, &bo->bo_dirty.bv_hd, b_bobufs) 437110584Sjeff if ((error = bp->b_error) == 0) 438110584Sjeff continue; 439145732Sjeff if (error == 0 && --maxretry >= 0) 440110584Sjeff goto loop1; 441110584Sjeff error = EAGAIN; 442110584Sjeff } 443110584Sjeff } 444110584Sjeff VI_UNLOCK(vp); 445144584Sjeff if (error == EAGAIN) 446144584Sjeff vprint("fsync: giving up on dirty", vp); 447112067Skan 448110584Sjeff return (error); 449110584Sjeff} 450112067Skan 45191690Seivind/* XXX Needs good comment and more info in the manpage (VOP_GETPAGES(9)). */ 45276167Sphkint 45376167Sphkvop_stdgetpages(ap) 45476167Sphk struct vop_getpages_args /* { 45576167Sphk struct vnode *a_vp; 45676167Sphk vm_page_t *a_m; 45776167Sphk int a_count; 45876167Sphk int a_reqpage; 45976167Sphk vm_ooffset_t a_offset; 46076167Sphk } */ *ap; 46176167Sphk{ 46276131Sphk 46376167Sphk return vnode_pager_generic_getpages(ap->a_vp, ap->a_m, 46476167Sphk ap->a_count, ap->a_reqpage); 46576167Sphk} 46676167Sphk 46791690Seivind/* XXX Needs good comment and more info in the manpage (VOP_PUTPAGES(9)). */ 46876319Sphkint 46976167Sphkvop_stdputpages(ap) 47076167Sphk struct vop_putpages_args /* { 47176167Sphk struct vnode *a_vp; 47276167Sphk vm_page_t *a_m; 47376167Sphk int a_count; 47476167Sphk int a_sync; 47576167Sphk int *a_rtvals; 47676167Sphk vm_ooffset_t a_offset; 47776167Sphk } */ *ap; 47876167Sphk{ 47976167Sphk 48076319Sphk return vnode_pager_generic_putpages(ap->a_vp, ap->a_m, ap->a_count, 48176167Sphk ap->a_sync, ap->a_rtvals); 48276167Sphk} 48376167Sphk 484112067Skan/* 48551068Salfred * vfs default ops 48691690Seivind * used to fill the vfs function table to get reasonable default return values. 48751068Salfred */ 48891690Seivindint 489144054Sjeffvfs_stdroot (mp, flags, vpp, td) 49051068Salfred struct mount *mp; 491144054Sjeff int flags; 49251068Salfred struct vnode **vpp; 493132023Salfred struct thread *td; 49451068Salfred{ 495131734Salfred 49651068Salfred return (EOPNOTSUPP); 49751068Salfred} 49851068Salfred 49991690Seivindint 50083366Sjulianvfs_stdstatfs (mp, sbp, td) 50151068Salfred struct mount *mp; 50251068Salfred struct statfs *sbp; 50383366Sjulian struct thread *td; 50451068Salfred{ 505131734Salfred 50651068Salfred return (EOPNOTSUPP); 50751068Salfred} 50851068Salfred 50951068Salfredint 51051068Salfredvfs_stdvptofh (vp, fhp) 51151068Salfred struct vnode *vp; 51251068Salfred struct fid *fhp; 51351068Salfred{ 514131734Salfred 51551068Salfred return (EOPNOTSUPP); 51651068Salfred} 51751068Salfred 51891690Seivindint 51983366Sjulianvfs_stdquotactl (mp, cmds, uid, arg, td) 52051068Salfred struct mount *mp; 52151068Salfred int cmds; 52251068Salfred uid_t uid; 52351068Salfred caddr_t arg; 52483366Sjulian struct thread *td; 52551068Salfred{ 526131734Salfred 52751068Salfred return (EOPNOTSUPP); 52851068Salfred} 52951068Salfred 530112067Skanint 531140048Sphkvfs_stdsync(mp, waitfor, td) 53251068Salfred struct mount *mp; 53351068Salfred int waitfor; 53483366Sjulian struct thread *td; 53551068Salfred{ 536112119Skan struct vnode *vp, *nvp; 537112119Skan int error, lockreq, allerror = 0; 538112119Skan 539112119Skan lockreq = LK_EXCLUSIVE | LK_INTERLOCK; 540112119Skan if (waitfor != MNT_WAIT) 541112119Skan lockreq |= LK_NOWAIT; 542112119Skan /* 543112119Skan * Force stale buffer cache information to be flushed. 544112119Skan */ 545122091Skan MNT_ILOCK(mp); 546112119Skanloop: 547131551Sphk MNT_VNODE_FOREACH(vp, mp, nvp) { 548112119Skan 549112119Skan VI_LOCK(vp); 550136943Sphk if (vp->v_bufobj.bo_dirty.bv_cnt == 0) { 551112119Skan VI_UNLOCK(vp); 552112119Skan continue; 553112119Skan } 554122091Skan MNT_IUNLOCK(mp); 555112119Skan 556112119Skan if ((error = vget(vp, lockreq, td)) != 0) { 557122091Skan MNT_ILOCK(mp); 558112119Skan if (error == ENOENT) 559112119Skan goto loop; 560112119Skan continue; 561112119Skan } 562140048Sphk error = VOP_FSYNC(vp, waitfor, td); 563112119Skan if (error) 564112119Skan allerror = error; 565112119Skan 566121874Skan VOP_UNLOCK(vp, 0, td); 567121874Skan vrele(vp); 568122091Skan MNT_ILOCK(mp); 569112119Skan } 570122091Skan MNT_IUNLOCK(mp); 571112119Skan return (allerror); 572112119Skan} 573112119Skan 574112119Skanint 575140048Sphkvfs_stdnosync (mp, waitfor, td) 576112119Skan struct mount *mp; 577112119Skan int waitfor; 578112119Skan struct thread *td; 579112119Skan{ 580131734Salfred 58151068Salfred return (0); 58251068Salfred} 58351068Salfred 584112067Skanint 58592462Smckusickvfs_stdvget (mp, ino, flags, vpp) 58651068Salfred struct mount *mp; 58751068Salfred ino_t ino; 58892462Smckusick int flags; 58951068Salfred struct vnode **vpp; 59051068Salfred{ 591131734Salfred 59251068Salfred return (EOPNOTSUPP); 59351068Salfred} 59451068Salfred 595112067Skanint 59651138Salfredvfs_stdfhtovp (mp, fhp, vpp) 59751068Salfred struct mount *mp; 59851068Salfred struct fid *fhp; 59951138Salfred struct vnode **vpp; 60051138Salfred{ 601131734Salfred 60251138Salfred return (EOPNOTSUPP); 60351138Salfred} 60451138Salfred 60551068Salfredint 606112067Skanvfs_stdinit (vfsp) 60751068Salfred struct vfsconf *vfsp; 60851068Salfred{ 609131734Salfred 61051068Salfred return (0); 61151068Salfred} 61251068Salfred 61351068Salfredint 61451068Salfredvfs_stduninit (vfsp) 61551068Salfred struct vfsconf *vfsp; 61651068Salfred{ 617131734Salfred 61851068Salfred return(0); 61951068Salfred} 62051068Salfred 62154803Srwatsonint 62283366Sjulianvfs_stdextattrctl(mp, cmd, filename_vp, attrnamespace, attrname, td) 62354803Srwatson struct mount *mp; 62454803Srwatson int cmd; 62574273Srwatson struct vnode *filename_vp; 62674437Srwatson int attrnamespace; 62756272Srwatson const char *attrname; 62883366Sjulian struct thread *td; 62954803Srwatson{ 630131734Salfred 631101786Sphk if (filename_vp != NULL) 632101786Sphk VOP_UNLOCK(filename_vp, 0, td); 633131734Salfred return (EOPNOTSUPP); 63454803Srwatson} 63554803Srwatson 636131733Salfredint 637131733Salfredvfs_stdsysctl(mp, op, req) 638131733Salfred struct mount *mp; 639131733Salfred fsctlop_t op; 640131733Salfred struct sysctl_req *req; 641131733Salfred{ 642131733Salfred 643131733Salfred return (EOPNOTSUPP); 644131733Salfred} 645131733Salfred 64651068Salfred/* end of vfs default ops */ 647