Subject: UFS crash
To: None <firstname.lastname@example.org>
From: Paul Kranenburg <email@example.com>
Date: 10/17/2000 16:02:14
I've had the pleasure of encountering the rare condition of running
out of space on a UFS filesystem while in the middle of creating
a new inode.
If an inode of type VBLK or VCHR is allocated in ufs_makeinode() it does not
immediately get a valid `v_specinfo' pointer, which means that you cannot
call vput() on it without running into trouble later on when the vnode
cleaning process is started. Yet this is what happens if e.g.,
ufs_direnter() fails, which is called from ufs_makeinode() after the vnode
type is set.
I've fixed this by doing
if (tvp->v_type == VBLK || tvp->v_type == VCHR)
tvp->v_type = VNON;
in the `bad:' code path in ufs_makeinode().
I think it's OK even to set the type VNON unconditionally before calling
vput(tvp) and returning the error. Comments?