1.\" $OpenBSD: vinvalbuf.9,v 1.13 2020/11/14 10:35:58 jmc Exp $ 2.\" 3.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice(s), this list of conditions and the following disclaimer as 10.\" the first lines of this file unmodified other than the possible 11.\" addition of one or more copyright notices. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice(s), this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 17.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 20.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 26.\" DAMAGE. 27.\" 28.\" $FreeBSD: src/share/man/man9/vinvalbuf.9,v 1.6 2001/10/06 11:19:41 sheldonh Exp $ 29.\" 30.Dd $Mdocdate: November 14 2020 $ 31.Dt VINVALBUF 9 32.Os 33.Sh NAME 34.Nm vinvalbuf 35.Nd flush and invalidate all buffers associated with a vnode 36.Sh SYNOPSIS 37.In sys/param.h 38.In sys/vnode.h 39.Ft int 40.Fn vinvalbuf "struct vnode *vp" "int flags" "struct ucred *cred" \ 41 "struct proc *p" "int slpflag" "uint64_t slptimeo" 42.Sh DESCRIPTION 43The 44.Fn vinvalbuf 45function invalidates all of the buffers associated with the given vnode. 46This includes buffers on the clean list and the dirty list. 47If the 48.Dv V_SAVE 49flag is specified then the buffers on the dirty list are synced prior to being 50released. 51If the 52.Dv V_SAVEMETA 53flag is set, indirect blocks will not be flushed. 54.Pp 55Its arguments are: 56.Bl -tag -width "slptimeo" 57.It Fa vp 58A pointer to the vnode whose buffers will be invalidated. 59.It Fa flags 60The supported flags are 61.Dv V_SAVE 62and 63.Dv V_SAVEMETA . 64.Dv V_SAVE 65indicates that dirty buffers should be synced with the disk. 66.Dv V_SAVEMETA 67indicates that indirect blocks should not be flushed. 68.It Fa cred 69The user credentials that are used to 70.Xr VOP_FSYNC 9 71buffers if 72.Dv V_SAVE 73is set. 74.It Fa p 75The process responsible for this call. 76.It Fa slpflag 77The slp flag that will be used in the priority of any calls to 78.Xr tsleep_nsec 9 79in the function. 80.It Fa slptimeo 81The timeout for any calls to 82.Xr tsleep_nsec 9 83in the function. 84.El 85.Sh LOCKS 86The vnode is assumed to be locked prior to the call and remains locked upon 87return. 88.Sh RETURN VALUES 89A value of 0 is returned on success. 90.Sh PSEUDOCODE 91.Bd -literal -offset indent 92vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY); 93error = vinvalbuf(devvp, V_SAVE, cred, p, 0, 0); 94VOP_UNLOCK(devvp); 95if (error) 96 return (error); 97.Ed 98.Sh ERRORS 99.Bl -tag -width Er 100.It Bq Er ENOSPC 101The file system is full. 102(With 103.Dv V_SAVE ) 104.It Bq Er EDQUOT 105Disc quota exceeded. 106(With 107.Dv V_SAVE ) 108.It Bq Er EWOULDBLOCK 109Sleep operation timed out. 110(See 111.Fa slptimeo ) 112.It Bq Er ERESTART 113A signal needs to be delivered and the system call should be restarted. 114(With 115.Dv PCATCH 116set in 117.Fa slpflag ) 118.It Bq Er EINTR 119The system has been interrupted by a signal. 120(With 121.Dv PCATCH 122set in 123.Fa slpflag ) 124.El 125.Sh SEE ALSO 126.Xr tsleep 9 , 127.Xr vnode 9 128.Sh AUTHORS 129This man page was originally written by 130.An Chad David Aq Mt davidc@acns.ab.ca 131for 132.Fx . 133