svn commit: r212340 - head/sys/kern
Pawel Jakub Dawidek
pjd at FreeBSD.org
Wed Sep 8 20:56:18 UTC 2010
Author: pjd
Date: Wed Sep 8 20:56:18 2010
New Revision: 212340
URL: http://svn.freebsd.org/changeset/base/212340
Log:
- 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
Modified:
head/sys/kern/vfs_mount.c
Modified: head/sys/kern/vfs_mount.c
==============================================================================
--- head/sys/kern/vfs_mount.c Wed Sep 8 20:35:43 2010 (r212339)
+++ head/sys/kern/vfs_mount.c Wed Sep 8 20:56:18 2010 (r212340)
@@ -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);
}
/*
More information about the svn-src-head
mailing list