Download raw body.
sys/vfs: skip DOCLOSE for incomplete spec vnodes
tech@,
several checkalias() callers discard the vnode passed to checkalias()
after moving its filesystem node to the returned alias. In the uncommon
block device alias case, checkalias() leaves that discarded vnode as a
shell: it uses spec_vops, but has no specinfo.
If vgonel() reclaims such a vnode while the caller still holds the last
reference, vclean(DOCLOSE) treats it as active and dispatches
VOP_CLOSE() to spec_close(), which expects v_specinfo to be present and
dereferences v_rdev.
Such shell vnodes do not represent an opened device instance, so there
is nothing to close through spec_vops. Skip DOCLOSE for spec_vops vnodes
without specinfo.
Ok?
Index: sys/kern/vfs_subr.c
===================================================================
RCS file: /home/cvs/src/sys/kern/vfs_subr.c,v
diff -u -p -r1.335 vfs_subr.c
--- sys/kern/vfs_subr.c 30 Jun 2026 14:04:03 -0000 1.335
+++ sys/kern/vfs_subr.c 7 Nov 2026 14:19:34 -0000
@@ -1174,7 +1174,7 @@ vgonel(struct vnode *vp, struct proc *p)
{
struct vnode *vq;
struct vnode *vx;
- int s;
+ int s, flags = DOCLOSE;
KASSERT(vp->v_uvcount == 0);
@@ -1194,7 +1194,9 @@ vgonel(struct vnode *vp, struct proc *p)
/*
* Clean out the filesystem specific data.
*/
- vclean(vp, DOCLOSE, p);
+ if (vp->v_op == &spec_vops && vp->v_specinfo == NULL)
+ flags = 0;
+ vclean(vp, flags, p);
/*
* Delete from old mount point vnode list, if on one.
*/
--
wbr, Kirill
sys/vfs: skip DOCLOSE for incomplete spec vnodes