--- //depot/projects/smpng/sys/kern/kern_descrip.c 2005/10/14 18:03:59 +++ //depot/user/jhb/proc/kern/kern_descrip.c 2005/10/19 18:38:16 @@ -1525,10 +1530,10 @@ { struct filedesc *fdp; struct file **fpp; - int i; + int i, locked; struct filedesc_to_leader *fdtol; struct file *fp; - struct vnode *vp; + struct vnode *cdir, *jdir, *rdir, *vp; struct flock lf; /* Certain daemons might not have file descriptors. */ @@ -1559,13 +1564,14 @@ lf.l_len = 0; lf.l_type = F_UNLCK; vp = fp->f_vnode; - VFS_ASSERT_GIANT(vp->v_mount); + locked = VFS_LOCK_GIANT(vp->v_mount); (void) VOP_ADVLOCK(vp, (caddr_t)td->td_proc-> p_leader, F_UNLCK, &lf, F_POSIX); + VFS_UNLOCK_GIANT(locked); FILEDESC_LOCK(fdp); fdrop(fp, td); fpp = fdp->fd_ofiles + i; @@ -1635,17 +1641,22 @@ fdp->fd_nfiles = 0; - if (fdp->fd_cdir) - vrele(fdp->fd_cdir); + cdir = fdp->fd_cdir; fdp->fd_cdir = NULL; - if (fdp->fd_rdir) - vrele(fdp->fd_rdir); + rdir = fdp->fd_rdir; fdp->fd_rdir = NULL; - if (fdp->fd_jdir) - vrele(fdp->fd_jdir); + jdir = fdp->fd_jdir; fdp->fd_jdir = NULL; + FILEDESC_UNLOCK(fdp); - FILEDESC_UNLOCK(fdp); + mtx_lock(&Giant); + if (cdir) + vrele(cdir); + if (rdir) + vrele(rdir); + if (jdir) + vrele(jdir); + mtx_unlock(&Giant); fddrop(fdp); } --- //depot/projects/smpng/sys/kern/kern_exit.c 2005/10/26 14:43:53 +++ //depot/user/jhb/proc/kern/kern_exit.c 2005/10/26 14:46:16 @@ -235,6 +238,7 @@ */ mtx_lock(&Giant); /* XXX: not sure if needed */ funsetownlst(&p->p_sigiolst); + mtx_unlock(&Giant); /* * If this process has an nlminfo data area (for lockd), release it @@ -247,7 +251,6 @@ * This may block! */ fdfree(td); - mtx_unlock(&Giant); /* * If this thread tickled GEOM, we need to wait for the giggling to --- //depot/projects/smpng/sys/kern/vfs_aio.c 2005/10/14 18:03:59 +++ //depot/user/jhb/proc/kern/vfs_aio.c 2005/10/19 19:48:27 @@ -877,10 +888,8 @@ * Get rid of our current filedescriptors. AIOD's don't need any * filedescriptors, except as temporarily inherited from the client. */ - mtx_lock(&Giant); fdfree(td); - mtx_unlock(&Giant); /* The daemon resides in its own pgrp. */ MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO);