Subject: Re: dump vnode list using sysctl
To: Ruibiao Qiu <ruibiao@arl.wustl.edu>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-kern
Date: 01/31/2001 14:57:47
Ruibiao Qiu wrote:

> Hi, all
> 
> I am trying to find out why our NFS server (NetBSD 1.4.1
> i386) stops working. The error is due to failure to convert NFS
> file handle to vnode pointer as my trace
> (in src/sys/nfs/nfs_subs.c) indicated.  It returns ESTALE after
> VFS_CHECKEXP().  I think that mp return earlier may be not right.
> I checked src/kern/vfs_subr.c, and found that there is a way to
> dump vnode list by sysctl command (sysctl_vnode()).  How can I use 
> sysctl to dump the list?  Thanks.

Most of the sysctls can be viewed with sysctl(8), and most of the
rest are helpful when you try to display them.  In this case:

	thoreau:~ 1> sysctl kern.vnode                                          
	sysctl: Use pstat to view kern.vnode information
	thoreau:~ 2> man pstat
	...
	     -v      Print the active vnodes.  [ ... ]
	thoreau:~ 3> pstat -v
	1995 active vnodes
	*** MOUNT ffs /dev/raid0a on / (local,rootfs)
	ADDR     TYP VFLAG  USE HOLD TAG FILEID IFLAG RDEV|SZ
	fffffc0006a39448 chr     -    1    0   1 240822     -    drum
	fffffc0004f43030 chr     -    1    0   1 240823     A    kmem
	fffffc0006463750 chr     -    1    0   1 240824     -     mem
	[ ... ]

Look in /usr/src/usr.sbin/pstat/pstat.c for details of how this is done.

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD CDs, Support and Service:    http://www.wasabisystems.com/