diff options
author | pjd <pjd@FreeBSD.org> | 2010-09-08 20:56:18 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2010-09-08 20:56:18 +0000 |
commit | 86d6e6cf7947691bfb3f3e9acafdbf44aa5e3821 (patch) | |
tree | 67366e474c3e9b3ddc09cb1024f04ded9b23d53c /sys/kern | |
parent | 73c5bdeaeb5ee8aa6b736b4af87b87cd8c07c7ba (diff) | |
download | FreeBSD-src-86d6e6cf7947691bfb3f3e9acafdbf44aa5e3821.zip FreeBSD-src-86d6e6cf7947691bfb3f3e9acafdbf44aa5e3821.tar.gz |
- Log all the problems in devfs_fixup().
- Correct error paths. The system will be useless on devfs_fixup() failure, so
why bother? Maybe for the same reason why a dead body is washed and dressed
in a nice suit before it is put into a coffin? Maybe system's last will is to
panic without any locks held?
Reviewed by: kib
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_mount.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index fe9f16c..3d3fcc8 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -1549,9 +1549,9 @@ static void devfs_fixup(struct thread *td) { struct nameidata nd; - int error; struct vnode *vp, *dvp; struct mount *mp; + int error; /* Remove our devfs mount from the mountlist and purge the cache */ mtx_lock(&mountlist_mtx); @@ -1575,16 +1575,26 @@ devfs_fixup(struct thread *td) error = namei(&nd); if (error) { printf("Lookup of /dev for devfs, error: %d\n", error); + vput(dvp); + vfs_unbusy(mp); return; } NDFREE(&nd, NDF_ONLY_PNBUF); vp = nd.ni_vp; if (vp->v_type != VDIR) { + printf("/dev is not a directory\n"); + vput(dvp); vput(vp); + vfs_unbusy(mp); + return; } error = vinvalbuf(vp, V_SAVE, 0, 0); if (error) { + printf("vinvalbuf() of /dev failed, error: %d\n", error); + vput(dvp); vput(vp); + vfs_unbusy(mp); + return; } cache_purge(vp); mp->mnt_vnodecovered = vp; @@ -1597,7 +1607,9 @@ devfs_fixup(struct thread *td) vfs_unbusy(mp); /* Unlink the no longer needed /dev/dev -> / symlink */ - kern_unlink(td, "/dev/dev", UIO_SYSSPACE); + error = kern_unlink(td, "/dev/dev", UIO_SYSSPACE); + if (error) + printf("kern_unlink of /dev/dev failed, error: %d\n", error); } /* |