summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2005-05-03 10:52:22 +0000
committerjeff <jeff@FreeBSD.org>2005-05-03 10:52:22 +0000
commit451e14446f914bff6d118da3d71fa31501ba406c (patch)
treeb92fcdf749d4d0b10f75025fa8a783c3c80f8871 /sys
parent617ce9900604573045160f4d6ce04eccc685462d (diff)
downloadFreeBSD-src-451e14446f914bff6d118da3d71fa31501ba406c.zip
FreeBSD-src-451e14446f914bff6d118da3d71fa31501ba406c.tar.gz
- Use NAMEI to pickup Giant if we need it in fpcheckstd().
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_descrip.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index c23dd90..81c6a38 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1784,8 +1784,6 @@ fdcheckstd(struct thread *td)
register_t retval;
int fd, i, error, flags, devnull;
- GIANT_REQUIRED; /* VFS */
-
fdp = td->td_proc->p_fd;
if (fdp == NULL)
return (0);
@@ -1796,13 +1794,14 @@ fdcheckstd(struct thread *td)
if (fdp->fd_ofiles[i] != NULL)
continue;
if (devnull < 0) {
+ int vfslocked;
error = falloc(td, &fp, &fd);
if (error != 0)
break;
/* Note extra ref on `fp' held for us by falloc(). */
KASSERT(fd == i, ("oof, we didn't get our fd"));
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, "/dev/null",
- td);
+ NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_SYSSPACE,
+ "/dev/null", td);
flags = FREAD | FWRITE;
error = vn_open(&nd, &flags, 0, -1);
if (error != 0) {
@@ -1821,6 +1820,7 @@ fdcheckstd(struct thread *td)
fdrop(fp, td);
break;
}
+ vfslocked = NDHASGIANT(&nd);
NDFREE(&nd, NDF_ONLY_PNBUF);
fp->f_flag = flags;
fp->f_vnode = nd.ni_vp;
@@ -1830,6 +1830,7 @@ fdcheckstd(struct thread *td)
fp->f_ops = &vnops;
fp->f_type = DTYPE_VNODE;
VOP_UNLOCK(nd.ni_vp, 0, td);
+ VFS_UNLOCK_GIANT(vfslocked);
devnull = fd;
fdrop(fp, td);
} else {
OpenPOWER on IntegriCloud