From owner-p4-projects@FreeBSD.ORG Fri Jun 23 18:34:39 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C6BFE16A4A9; Fri, 23 Jun 2006 18:34:39 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 729BD16A4A0 for ; Fri, 23 Jun 2006 18:34:39 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 202EE43D46 for ; Fri, 23 Jun 2006 18:34:39 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k5NIYcOo041087 for ; Fri, 23 Jun 2006 18:34:38 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k5NIYcUJ041084 for perforce@freebsd.org; Fri, 23 Jun 2006 18:34:38 GMT (envelope-from jhb@freebsd.org) Date: Fri, 23 Jun 2006 18:34:38 GMT Message-Id: <200606231834.k5NIYcUJ041084@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 99881 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jun 2006 18:34:40 -0000 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;