From 6de925e58b160b85da451953d8d6d3ada2e6f83c Mon Sep 17 00:00:00 2001 From: Jeff Roberson Date: Tue, 3 May 2005 10:52:22 +0000 Subject: [PATCH] - Use NAMEI to pickup Giant if we need it in fpcheckstd(). --- sys/kern/kern_descrip.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index c23dd9087d60..81c6a380ecae 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 {