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