Date: Fri, 23 Jun 2006 18:34:38 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 99881 for review Message-ID: <200606231834.k5NIYcUJ041084@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=99881 Change 99881 by jhb@jhb_mutex on 2006/06/23 18:33:38 Add conditional VFS-Giant locking to ogetdirentries(). Affected files ... .. //depot/projects/smpng/sys/kern/vfs_syscalls.c#106 edit Differences ... ==== //depot/projects/smpng/sys/kern/vfs_syscalls.c#106 (text+ko) ==== @@ -3569,7 +3569,7 @@ struct iovec aiov, kiov; struct dirent *dp, *edp; caddr_t dirbuf; - int error, eofflag, readcnt; + int error, eofflag, readcnt, vfslocked; long loff; /* XXX arbitrary sanity limit on `count'. */ @@ -3583,7 +3583,9 @@ } vp = fp->f_vnode; unionread: + vfslocked = VFS_LOCK_GIANT(vp->v_mount); if (vp->v_type != VDIR) { + VFS_UNLOCK_GIANT(vfslocked); fdrop(fp, td); return (EINVAL); } @@ -3601,6 +3603,7 @@ error = mac_check_vnode_readdir(td->td_ucred, vp); if (error) { VOP_UNLOCK(vp, 0, td); + VFS_UNLOCK_GIANT(vfslocked); fdrop(fp, td); return (error); } @@ -3658,15 +3661,19 @@ } VOP_UNLOCK(vp, 0, td); if (error) { + VFS_UNLOCK_GIANT(vfslocked); fdrop(fp, td); return (error); } if (uap->count == auio.uio_resid) { if (union_dircheckp) { error = union_dircheckp(td, &vp, fp); - if (error == -1) + if (error == -1) { + VFS_UNLOCK_GIANT(vfslocked); goto unionread; + } if (error) { + VFS_UNLOCK_GIANT(vfslocked); fdrop(fp, td); return (error); } @@ -3685,10 +3692,12 @@ fp->f_data = vp; fp->f_offset = 0; vput(tvp); + VFS_UNLOCK_GIANT(vfslocked); goto unionread; } VOP_UNLOCK(vp, 0, td); } + VFS_UNLOCK_GIANT(vfslocked); error = copyout(&loff, uap->basep, sizeof(long)); fdrop(fp, td); td->td_retval[0] = uap->count - auio.uio_resid;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606231834.k5NIYcUJ041084>