When getnewvnode() is called the vnode's v_type defaults to VNON. Syncer
authorMatthew Dillon <dillon@dragonflybsd.org>
Thu, 14 Jun 2007 02:55:27 +0000 (02:55 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Thu, 14 Jun 2007 02:55:27 +0000 (02:55 +0000)
commit986e7cda45a4185f73f9862518cacb0a2ca02326
tree787b0ce4ce1c47fb6f1dec5c7903d778d834ad3a
parentc830df57697e11c8c778f8938596b368c00856fe
When getnewvnode() is called the vnode's v_type defaults to VNON.  Syncer
vnodes are also set to VNON and any vnode that is accessed without locking
whos v_type is VNON is probably in the middle of being initialized.  For
this reason the mountlist scan and vflush code typically ignores such
vnodes.

If a read error occurs while initializing a vnode, in particular if a hash
collision occurs or an I/O error occurs reading the inode, the vnode's
v_type was being left set to VNON.  Explicitly set it to VBAD for msdosfs
and ufs (other FS's probably need the same treatment) so the flush and
reclaim code can reuse the vnode.

This fixes 'dangling vnode' panics on unmount for filesystems which incur
I/O errors, such as when one pulls a USB memory stick out while it is
still mounted.
sys/kern/vfs_mount.c
sys/vfs/msdosfs/msdosfs_denode.c
sys/vfs/msdosfs/msdosfs_vfsops.c
sys/vfs/ufs/ffs_inode.c