From owner-svn-src-all@FreeBSD.ORG Thu Jun 3 10:24:53 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A25FC1065673; Thu, 3 Jun 2010 10:24:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 91DDA8FC0A; Thu, 3 Jun 2010 10:24:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o53AOrGE044396; Thu, 3 Jun 2010 10:24:53 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53AOr0g044394; Thu, 3 Jun 2010 10:24:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201006031024.o53AOr0g044394@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 3 Jun 2010 10:24:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208774 - head/sys/ufs/ufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 10:24:53 -0000 Author: kib Date: Thu Jun 3 10:24:53 2010 New Revision: 208774 URL: http://svn.freebsd.org/changeset/base/208774 Log: Extend the scope of the lock on the quota file vnode in quotaon() to cover the initial read by dqopen(). Assert that vnode is locked in dqopen(). Remove VFS_LOCK_GIANT() from dqopen(), since quotaon() keeps Giant locked if needed around the call. Modified: head/sys/ufs/ufs/ufs_quota.c Modified: head/sys/ufs/ufs/ufs_quota.c ============================================================================== --- head/sys/ufs/ufs/ufs_quota.c Thu Jun 3 10:20:08 2010 (r208773) +++ head/sys/ufs/ufs/ufs_quota.c Thu Jun 3 10:24:53 2010 (r208774) @@ -522,8 +522,8 @@ quotaon(struct thread *td, struct mount vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); vp = nd.ni_vp; - VOP_UNLOCK(vp, 0); if (vp->v_type != VREG) { + VOP_UNLOCK(vp, 0); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); VFS_UNLOCK_GIANT(vfslocked); return (EACCES); @@ -532,6 +532,7 @@ quotaon(struct thread *td, struct mount UFS_LOCK(ump); if ((ump->um_qflags[type] & (QTF_OPENING|QTF_CLOSING)) != 0) { UFS_UNLOCK(ump); + VOP_UNLOCK(vp, 0); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); VFS_UNLOCK_GIANT(vfslocked); return (EALREADY); @@ -539,6 +540,7 @@ quotaon(struct thread *td, struct mount ump->um_qflags[type] |= QTF_OPENING|QTF_CLOSING; UFS_UNLOCK(ump); if ((error = dqopen(vp, ump, type)) != 0) { + VOP_UNLOCK(vp, 0); UFS_LOCK(ump); ump->um_qflags[type] &= ~(QTF_OPENING|QTF_CLOSING); UFS_UNLOCK(ump); @@ -546,6 +548,7 @@ quotaon(struct thread *td, struct mount VFS_UNLOCK_GIANT(vfslocked); return (error); } + VOP_UNLOCK(vp, 0); MNT_ILOCK(mp); mp->mnt_flag |= MNT_QUOTA; MNT_IUNLOCK(mp); @@ -1169,8 +1172,9 @@ dqopen(struct vnode *vp, struct ufsmount struct dqhdr64 dqh; struct iovec aiov; struct uio auio; - int error, vfslocked; + int error; + ASSERT_VOP_LOCKED(vp, "dqopen"); auio.uio_iov = &aiov; auio.uio_iovcnt = 1; aiov.iov_base = &dqh; @@ -1180,9 +1184,7 @@ dqopen(struct vnode *vp, struct ufsmount auio.uio_segflg = UIO_SYSSPACE; auio.uio_rw = UIO_READ; auio.uio_td = (struct thread *)0; - vfslocked = VFS_LOCK_GIANT(vp->v_mount); error = VOP_READ(vp, &auio, 0, ump->um_cred[type]); - VFS_UNLOCK_GIANT(vfslocked); if (error != 0) return (error);