When getnewvnode() is called the vnode's v_type defaults to VNON. Syncer
commitaba19a303c40bbea467ad065efb3e93b68dfb3ca
authorMatthew Dillon <dillon@dragonflybsd.org>
Thu, 14 Jun 2007 02:55:27 +0000 (14 02:55 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Thu, 14 Jun 2007 02:55:27 +0000 (14 02:55 +0000)
tree7d8bbb44ca6d6a6273e0341a79f030964c64d107
parent2e4847ed73bdf44925947cfde7704b7a80f66dc9
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