1.\" $NetBSD: vnode.9,v 1.51 2010/12/02 12:54:13 wiz Exp $ 2.\" 3.\" Copyright (c) 2001, 2005, 2006 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Gregory McGarry. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.Dd July 21, 2010 31.Dt VNODE 9 32.Os 33.Sh NAME 34.Nm vnode , 35.Nm vref , 36.Nm vrele , 37.Nm vrele_async , 38.Nm vget , 39.Nm vput , 40.Nm vhold , 41.Nm holdrele , 42.Nm getnewvnode , 43.Nm ungetnewvnode , 44.Nm vrecycle , 45.Nm vgone , 46.Nm vgonel , 47.Nm vflush , 48.Nm vaccess , 49.Nm bdevvp , 50.Nm cdevvp , 51.Nm vfinddev , 52.Nm vdevgone , 53.Nm vwakeup , 54.Nm vflushbuf , 55.Nm vinvalbuf , 56.Nm vtruncbuf , 57.Nm vprint 58.Nd kernel representation of a file or directory 59.Sh SYNOPSIS 60.In sys/param.h 61.In sys/vnode.h 62.Ft void 63.Fn vref "struct vnode *vp" 64.Ft void 65.Fn vrele "struct vnode *vp" 66.Ft void 67.Fn vrele_async "struct vnode *vp" 68.Ft int 69.Fn vget "struct vnode *vp" "int lockflag" 70.Ft void 71.Fn vput "struct vnode *vp" 72.Ft void 73.Fn vhold "struct vnode *vp" 74.Ft void 75.Fn holdrele "struct vnode *vp" 76.Ft int 77.Fn getnewvnode "enum vtagtype tag" "struct mount *mp" "int (**vops)(void *)" "struct vnode **vpp" 78.Ft void 79.Fn ungetnewvnode "struct vnode *vp" 80.Ft int 81.Fn vrecycle "struct vnode *vp" "struct simplelock *inter_lkp" "struct lwp *l" 82.Ft void 83.Fn vgone "struct vnode *vp" 84.Ft void 85.Fn vgonel "struct vnode *vp" "struct lwp *l" 86.Ft int 87.Fn vflush "struct mount *mp" "struct vnode *skipvp" "int flags" 88.Ft int 89.Fn vaccess "enum vtype type" "mode_t file_mode" "uid_t uid" "gid_t gid" "mode_t acc_mode" "kauth_cred_t cred" 90.Ft int 91.Fn bdevvp "dev_t dev" "struct vnode **vpp" 92.Ft int 93.Fn cdevvp "dev_t dev" "struct vnode **vpp" 94.Ft int 95.Fn vfinddev "dev_t dev" "enum vtype" "struct vnode **vpp" 96.Ft void 97.Fn vdevgone "int maj" "int minl" "int minh" "enum vtype type" 98.Ft void 99.Fn vwakeup "struct buf *bp" 100.Ft void 101.Fn vflushbuf "struct vnode *vp" "int sync" 102.Ft int 103.Fn vinvalbuf "struct vnode *vp" "int flags" "kauth_cred_t cred" "struct lwp *l" "int slpflag" "int slptimeo" 104.Ft int 105.Fn vtruncbuf "struct vnode *vp" "daddr_t lbn" "int slpflag" "int slptimeo" 106.Ft void 107.Fn vprint "const char *label" "struct vnode *vp" 108.Sh DESCRIPTION 109The vnode is the focus of all file activity in 110.Nx . 111There is a unique vnode allocated for each active file, directory, 112mounted-on file, fifo, domain socket, symbolic link and device. 113The kernel has no concept of a file's underlying structure and so it 114relies on the information stored in the vnode to describe the file. 115Thus, the vnode associated with a file holds all the administration 116information pertaining to it. 117.Pp 118When a process requests an operation on a file, the 119.Xr vfs 9 120interface passes control to a file system type dependent function to carry 121out the operation. 122If the file system type dependent function finds that a vnode 123representing the file is not in main memory, it dynamically allocates 124a new vnode from the system main memory pool. 125Once allocated, the vnode is attached to the data structure pointer 126associated with the cause of the vnode allocation and it remains 127resident in the main memory until the system decides that it is no 128longer needed and can be recycled. 129.Pp 130The vnode has the following structure: 131.Bd -literal 132struct vnode { 133 struct uvm_object v_uobj; /* the VM object */ 134 kcondvar_t v_cv; /* synchronization */ 135 voff_t v_size; /* size of file */ 136 voff_t v_writesize; /* new size after write */ 137 int v_iflag; /* VI_* flags */ 138 int v_vflag; /* VV_* flags */ 139 int v_uflag; /* VU_* flags */ 140 int v_numoutput; /* # of pending writes */ 141 int v_writecount; /* ref count of writers */ 142 int v_holdcnt; /* page & buffer refs */ 143 int v_synclist_slot; /* synclist slot index */ 144 struct mount *v_mount; /* ptr to vfs we are in */ 145 int (**v_op)(void *); /* vnode operations vector */ 146 TAILQ_ENTRY(vnode) v_freelist; /* vnode freelist */ 147 struct vnodelst *v_freelisthd; /* which freelist? */ 148 TAILQ_ENTRY(vnode) v_mntvnodes; /* vnodes for mount point */ 149 struct buflists v_cleanblkhd; /* clean blocklist head */ 150 struct buflists v_dirtyblkhd; /* dirty blocklist head */ 151 TAILQ_ENTRY(vnode) v_synclist; /* vnodes with dirty bufs */ 152 LIST_HEAD(, namecache) v_dnclist; /* namecaches (children) */ 153 LIST_HEAD(, namecache) v_nclist; /* namecaches (parent) */ 154 union { 155 struct mount *vu_mountedhere;/* ptr to vfs (VDIR) */ 156 struct socket *vu_socket; /* unix ipc (VSOCK) */ 157 struct specnode *vu_specnode; /* device (VCHR, VBLK) */ 158 struct fifoinfo *vu_fifoinfo; /* fifo (VFIFO) */ 159 struct uvm_ractx *vu_ractx; /* read-ahead ctx (VREG) */ 160 } v_un; 161 enum vtype v_type; /* vnode type */ 162 enum vtagtype v_tag; /* type of underlying data */ 163 struct vnlock v_lock; /* lock for this vnode */ 164 void *v_data; /* private data for fs */ 165 struct klist v_klist; /* notes attached to vnode */ 166}; 167.Ed 168.Pp 169Most members of the vnode structure should be treated as opaque and 170only manipulated using the proper functions. 171There are some rather common exceptions detailed throughout this page. 172.Pp 173Files and file systems are inextricably linked with the virtual memory 174system and 175.Em v_uobj 176contains the data maintained by the virtual memory system. 177For compatibility with code written before the integration of 178.Xr uvm 9 179into 180.Nx , 181C-preprocessor directives are used to alias the members of 182.Em v_uobj . 183.Pp 184Vnode flags are recorded by 185.Em v_flag . 186Valid flags are: 187.Pp 188.Bl -tag -offset indent -width VONWORKLST -compact 189.It VROOT 190This vnode is the root of its file system. 191.It VTEXT 192This vnode is a pure text prototype. 193.It VSYSTEM 194This vnode is being used by the kernel; only used to skip quota files in 195.Fn vflush . 196.It VISTTY 197This vnode represents a tty; used when reading dead vnodes. 198.It VEXECMAP 199This vnode has executable mappings. 200.It VWRITEMAP 201This vnode might have PROT_WRITE user mappings. 202.It VWRITEMAPDIRTY 203This vnode might have dirty pages due to VWRITEMAP 204.It VLOCKSWORK 205This vnode's file system supports locking. 206.It VXLOCK 207This vnode is currently locked to change underlying type. 208.It VXWANT 209A process is waiting for this vnode. 210.It VBWAIT 211Waiting for output associated with this vnode to complete. 212.It VALIASED 213This vnode has an alias. 214.It VDIROP 215This vnode is involved in a directory operation. 216This flag is used exclusively by LFS. 217.It VLAYER 218This vnode is on a layered file system. 219.It VONWORKLST 220This vnode is on syncer work-list. 221.It VFREEING 222This vnode is being freed. 223.It VMAPPED 224This vnode might have user mappings. 225.El 226.Pp 227The VXLOCK flag is used to prevent multiple processes from entering 228the vnode reclamation code. 229It is also used as a flag to indicate that reclamation is in progress. 230The VXWANT flag is set by threads that wish to be awakened when 231reclamation is finished. 232Before 233.Em v_flag 234can be modified, the 235.Em v_interlock 236simplelock must be acquired. 237See 238.Xr lock 9 239for details on the kernel locking API. 240.Pp 241Each vnode has three reference counts: 242.Em v_usecount , 243.Em v_writecount 244and 245.Em v_holdcnt . 246The first is the number of active references within the 247kernel to the vnode. 248This count is maintained by 249.Fn vref , 250.Fn vrele , 251.Fn vrele_async , 252and 253.Fn vput . 254The second is the number of active references within the kernel to the 255vnode performing write access to the file. 256It is maintained by the 257.Xr open 2 258and 259.Xr close 2 260system calls. 261The third is the number of references within the kernel 262requiring the vnode to remain active and not be recycled. 263This count is maintained by 264.Fn vhold 265and 266.Fn holdrele . 267When both the 268.Em v_usecount 269and 270.Em v_holdcnt 271reach zero, the vnode is recycled to the freelist and may be reused 272for another file. 273The transition to and from the freelist is handled by 274.Fn getnewvnode , 275.Fn ungetnewvnode 276and 277.Fn vrecycle . 278Access to 279.Em v_usecount , 280.Em v_writecount 281and 282.Em v_holdcnt 283is also protected by the 284.Em v_interlock 285simplelock. 286.Pp 287The number of pending synchronous and asynchronous writes on the 288vnode are recorded in 289.Em v_numoutput . 290It is used by 291.Xr fsync 2 292to wait for all writes to complete before returning to the user. 293Its value must only be modified at splbio (see 294.Xr spl 9 ) . 295It does not track the number of dirty buffers attached to the 296vnode. 297.Pp 298.Em v_dnclist 299and 300.Em v_nclist 301are used by 302.Xr namecache 9 303to maintain the list of associated entries so that 304.Xr cache_purge 9 305can purge them. 306.Pp 307The link to the file system which owns the vnode is recorded by 308.Em v_mount . 309See 310.Xr vfsops 9 311for further information of file system mount status. 312.Pp 313The 314.Em v_op 315pointer points to its vnode operations vector. 316This vector describes what operations can be done to the file associated 317with the vnode. 318The system maintains one vnode operations vector for each file system 319type configured into the kernel. 320The vnode operations vector contains a pointer to a function for 321each operation supported by the file system. 322See 323.Xr vnodeops 9 324for a description of vnode operations. 325.Pp 326When not in use, vnodes are kept on the freelist through 327.Em v_freelist . 328The vnodes still reference valid files but may be reused to refer to a 329new file at any time. 330When a valid vnode which is on the freelist is used again, the user 331must call 332.Fn vget 333to increment the reference count and retrieve it from the freelist. 334When a user wants a new vnode for another file, 335.Fn getnewvnode 336is invoked to remove a vnode from the freelist and initialize it for 337the new file. 338.Pp 339The type of object the vnode represents is recorded by 340.Em v_type . 341It is used by generic code to perform checks to ensure operations are 342performed on valid file system objects. 343Valid types are: 344.Pp 345.Bl -tag -offset indent -width VFIFO -compact 346.It VNON 347The vnode has no type. 348.It VREG 349The vnode represents a regular file. 350.It VDIR 351The vnode represents a directory. 352.It VBLK 353The vnode represents a block special device. 354.It VCHR 355The vnode represents a character special device. 356.It VLNK 357The vnode represents a symbolic link. 358.It VSOCK 359The vnode represents a socket. 360.It VFIFO 361The vnode represents a pipe. 362.It VBAD 363The vnode represents a bad file (not currently used). 364.El 365.Pp 366Vnode tag types are used by external programs only (e.g., 367.Xr pstat 8 ) , 368and should never be inspected by the kernel. 369Its use is deprecated 370since new 371.Em v_tag 372values cannot be defined for loadable file systems. 373The 374.Em v_tag 375member is read-only. 376Valid tag types are: 377.Pp 378.Bl -tag -offset indent -width "VT_FILECORE " -compact 379.It VT_NON 380non file system 381.It VT_UFS 382universal file system 383.It VT_NFS 384network file system 385.It VT_MFS 386memory file system 387.It VT_MSDOSFS 388FAT file system 389.It VT_LFS 390log-structured file system 391.It VT_LOFS 392loopback file system 393.It VT_FDESC 394file descriptor file system 395.It VT_NULL 396null file system layer 397.It VT_UMAP 398uid/gid remapping file system layer 399.It VT_KERNFS 400kernel interface file system 401.It VT_PROCFS 402process interface file system 403.It VT_AFS 404AFS file system 405.It VT_ISOFS 406ISO 9660 file system(s) 407.It VT_UNION 408union file system 409.It VT_ADOSFS 410Amiga file system 411.It VT_EXT2FS 412Linux's ext2 file system 413.It VT_CODA 414Coda file system 415.It VT_FILECORE 416filecore file system 417.It VT_NTFS 418Microsoft NT's file system 419.It VT_VFS 420virtual file system 421.It VT_OVERLAY 422overlay file system 423.It VT_SMBFS 424SMB file system 425.It VT_PTYFS 426pseudo-terminal device file system 427.It VT_TMPFS 428efficient memory file system 429.It VT_UDF 430universal disk format file system 431.It VT_SYSVBFS 432systemV boot file system 433.El 434.Pp 435All vnode locking operations use 436.Em v_lock . 437This lock is acquired by calling 438.Xr vn_lock 9 439and released by calling 440.Xr VOP_UNLOCK 9 . 441The reason for this asymmetry is that 442.Xr vn_lock 9 443is a wrapper for 444.Xr VOP_LOCK 9 445with extra checks, while the unlocking step usually does not need 446additional checks and thus has no wrapper. 447.Pp 448The vnode locking operation is complicated because it is used for many 449purposes. 450Sometimes it is used to bundle a series of vnode operations (see 451.Xr vnodeops 9 ) 452into an atomic group. 453Many file systems rely on it to prevent race conditions in updating 454file system type specific data structures rather than using their 455own private locks. 456The vnode lock can operate as a multiple-reader (shared-access lock) 457or single-writer lock (exclusive access lock), however many current file 458system implementations were written assuming only single-writer 459locking. 460Multiple-reader locking functions equivalently only in the presence 461of big-lock SMP locking or a uni-processor machine. 462The lock may be held while sleeping. 463While the 464.Em v_lock 465is acquired, the holder is guaranteed that the vnode will not be 466reclaimed or invalidated. 467Most file system functions require that you hold the vnode lock on entry. 468See 469.Xr lock 9 470for details on the kernel locking API. 471.Pp 472Each file system underlying a vnode allocates its own private area and 473hangs it from 474.Em v_data . 475.Pp 476Most functions discussed in this page that operate on vnodes cannot be 477called from interrupt context. 478The members 479.Em v_numoutput , 480.Em v_holdcnt , 481.Em v_dirtyblkhd , 482.Em v_cleanblkhd , 483.Em v_freelist , 484and 485.Em v_synclist 486are modified in interrupt context and must be protected by 487.Xr splbio 9 488unless it is certain that there is no chance an interrupt handler will 489modify them. 490The vnode lock must not be acquired within interrupt context. 491.Sh FUNCTIONS 492.Bl -tag -width compact 493.It Fn vref "vp" 494Increment 495.Em v_usecount 496of the vnode 497.Em vp . 498Any kernel thread system which uses a vnode (e.g., during the operation 499of some algorithm or to store in a data structure) should call 500.Fn vref . 501.It Fn vrele "vp" 502Decrement 503.Em v_usecount 504of unlocked vnode 505.Em vp . 506Any code in the system which is using a vnode should call 507.Fn vrele 508when it is finished with the vnode. 509If 510.Em v_usecount 511of the vnode reaches zero and 512.Em v_holdcnt 513is greater than zero, the vnode is placed on the holdlist. 514If both 515.Em v_usecount 516and 517.Em v_holdcnt 518are zero, the vnode is placed on the freelist. 519.It Fn vrele_async "vp" 520Will asychronously release the vnode in different context than the caller, 521sometime after the call. 522.It Fn vget "vp" "lockflags" 523Reclaim vnode 524.Fa vp 525from the freelist, increment its reference count and lock it. 526The argument 527.Fa lockflags 528specifies the 529.Xr lockmgr 9 530flags used to lock the vnode. 531If the VXLOCK is set in 532.Fa vp Ns 's 533.Em v_flag , 534vnode 535.Fa vp 536is being recycled in 537.Fn vgone 538and the calling thread sleeps until the transition is complete. 539When it is awakened, an error is returned to indicate that the vnode is 540no longer usable (possibly having been recycled to a new file system type). 541.It Fn vput "vp" 542Unlock vnode 543.Fa vp 544and decrement its 545.Em v_usecount . 546Depending on the reference counts, move the vnode to the holdlist or 547the freelist. 548This operation is functionally equivalent to calling 549.Xr VOP_UNLOCK 9 550followed by 551.Fn vrele . 552.It Fn vhold "vp" 553Mark the vnode 554.Fa vp 555as active by incrementing 556.Em vp-\*[Gt]v_holdcnt 557and moving the vnode from the freelist to the holdlist. 558Once on the holdlist, the vnode will not be recycled until it is 559released with 560.Fn holdrele . 561.It Fn holdrele "vp" 562Mark the vnode 563.Fa vp 564as inactive by decrementing 565.Em vp-\*[Gt]v_holdcnt 566and moving the vnode from the holdlist to the freelist. 567.It Fn getnewvnode "tag" "mp" "vops" "vpp" 568Retrieve the next vnode from the freelist. 569.Fn getnewvnode 570must choose whether to allocate a new vnode or recycle an existing 571one. 572The criterion for allocating a new one is that the total number of 573vnodes is less than the number desired or there are no vnodes on either 574free list. 575Generally only vnodes that have no buffers associated with them are 576recycled and the next vnode from the freelist is retrieved. 577If the freelist is empty, vnodes on the holdlist are considered. 578The new vnode is returned in the address specified by 579.Fa vpp . 580.Pp 581The argument 582.Fa mp 583is the mount point for the file system requested the new vnode. 584Before retrieving the new vnode, the file system is checked if it is 585busy (such as currently unmounting). 586An error is returned if the file system is unmounted. 587.Pp 588The argument 589.Fa tag 590is the vnode tag assigned to 591.Fa *vpp-\*[Gt]v_tag . 592The argument 593.Fa vops 594is the vnode operations vector of the file system requesting the new 595vnode. 596If a vnode is successfully retrieved zero is returned, otherwise an 597appropriate error code is returned. 598.It Fn ungetnewvnode "vp" 599Undo the operation of 600.Fn getnewvnode . 601The argument 602.Fa vp 603is the vnode to return to the freelist. 604This function is needed for 605.Xr VFS_VGET 9 606which may need to push back a vnode in case of a locking race 607condition. 608.It Fn vrecycle "vp" "inter_lkp" "l" 609Recycle the unused vnode 610.Fa vp 611to the front of the freelist. 612.Fn vrecycle 613is a null operation if the reference count is greater than zero. 614.It Fn vgone "vp" 615Eliminate all activity associated with the unlocked vnode 616.Fa vp 617in preparation for recycling. 618.It Fn vgonel "vp" "p" 619Eliminate all activity associated with the locked vnode 620.Fa vp 621in preparation for recycling. 622.It Fn vflush "mp" "skipvp" "flags" 623Remove any vnodes in the vnode table belonging to mount point 624.Fa mp . 625If 626.Fa skipvp 627is not NULL it is exempt from being flushed. 628The argument 629.Fa flags 630is a set of flags modifying the operation of 631.Fn vflush . 632If FORCECLOSE is not specified, there should not be any active vnodes and 633the error 634.Er EBUSY 635is returned if any are found (this is a user error, not a system error). 636If FORCECLOSE is specified, active vnodes that are found are detached. 637If WRITECLOSE is set, only flush out regular file vnodes open for 638writing. 639SKIPSYSTEM causes any vnodes marked V_SYSTEM to be skipped. 640.It Fn vaccess "type" "file_mode" "uid" "gid" "acc_mode" "cred" 641Do access checking by comparing the file's permissions to the caller's 642desired access type 643.Fa acc_mode 644and credentials 645.Fa cred . 646.It Fn bdevvp "dev" "vpp" 647Create a vnode for a block device. 648.Fn bdevvp 649is used for root file systems, swap areas and for memory file system 650special devices. 651.It Fn cdevvp "dev" "vpp" 652Create a vnode for a character device. 653.Fn cdevvp 654is used for the console and kernfs special devices. 655.It Fn vfinddev "dev" "vtype" "vpp" 656Lookup a vnode by device number. 657The vnode is referenced and returned in the address specified by 658.Fa vpp . 659.It Fn vdevgone "int maj" "int min" "int minh" "enum vtype type" 660Reclaim all vnodes that correspond to the specified minor number range 661.Fa minl 662to 663.Fa minh 664(endpoints inclusive) of the specified major 665.Fa maj . 666.It Fn vwakeup "bp" 667Update outstanding I/O count 668.Em vp-\*[Gt]v_numoutput 669for the vnode 670.Em bp-\*[Gt]b_vp 671and do a wakeup if requested and 672.Em vp-\*[Gt]vflag 673has VBWAIT set. 674.It Fn vflushbuf "vp" "sync" 675Flush all dirty buffers to disk for the file with the locked vnode 676.Fa vp . 677The argument 678.Fa sync 679specifies whether the I/O should be synchronous and 680.Fn vflushbuf 681will sleep until 682.Em vp-\*[Gt]v_numoutput 683is zero and 684.Em vp-\*[Gt]v_dirtyblkhd 685is empty. 686.It Fn vinvalbuf "vp" "flags" "cred" "l" "slpflag" "slptimeo" 687Flush out and invalidate all buffers associated with locked vnode 688.Fa vp . 689The argument 690.Fa l 691and 692.Fa cred 693specified the calling process and its credentials. 694The 695.Xr ltsleep 9 696flag and timeout are specified by the arguments 697.Fa slpflag 698and 699.Fa slptimeo 700respectively. 701If the operation is successful zero is returned, otherwise an 702appropriate error code is returned. 703.It Fn vtruncbuf "vp" "lbn" "slpflag" "slptimeo" 704Destroy any in-core buffers past the file truncation length for the 705locked vnode 706.Fa vp . 707The truncation length is specified by 708.Fa lbn . 709.Fn vtruncbuf 710will sleep while the I/O is performed, The 711.Xr ltsleep 9 712flag and timeout are specified by the arguments 713.Fa slpflag 714and 715.Fa slptimeo 716respectively. 717If the operation is successful zero is returned, otherwise an 718appropriate error code is returned. 719.It Fn vprint "label" "vp" 720This function is used by the kernel to dump vnode information during a 721panic. 722It is only used if the kernel option DIAGNOSTIC is compiled into the kernel. 723The argument 724.Fa label 725is a string to prefix the information dump of vnode 726.Fa vp . 727.El 728.Sh CODE REFERENCES 729The vnode framework is implemented within the file 730.Pa sys/kern/vfs_subr.c . 731.Sh SEE ALSO 732.Xr intro 9 , 733.Xr lock 9 , 734.Xr namecache 9 , 735.Xr namei 9 , 736.Xr uvm 9 , 737.Xr vattr 9 , 738.Xr vfs 9 , 739.Xr vfsops 9 , 740.Xr vnodeops 9 , 741.Xr vnsubr 9 742.Sh BUGS 743The locking protocol is inconsistent. 744Many vnode operations are passed locked vnodes on entry but release 745the lock before they exit. 746The locking protocol is used in some places to attempt to make a 747series of operations atomic (e.g., access check then operation). 748This does not work for non-local file systems that do not support locking 749(e.g., NFS). 750The 751.Nm 752interface would benefit from a simpler locking protocol. 753