From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 29 01:39:41 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED3A1106566B; Wed, 29 Feb 2012 01:39:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D849F8FC16; Wed, 29 Feb 2012 01:39:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1T1dd8U001564; Wed, 29 Feb 2012 01:39:39 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1T1ddtj001562; Wed, 29 Feb 2012 01:39:39 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201202290139.q1T1ddtj001562@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Feb 2012 01:39:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232285 - stable/9/sys/ufs/ufs X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Feb 2012 01:39:41 -0000 Author: kib Date: Wed Feb 29 01:39:39 2012 New Revision: 232285 URL: http://svn.freebsd.org/changeset/base/232285 Log: MFC r232003: Properly lock DQREF() with dqhlock. Missed locking caused counter corruption. Assert that the dq reference value is sane before decrementing it. Modified: stable/9/sys/ufs/ufs/ufs_quota.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ufs/ufs/ufs_quota.c ============================================================================== --- stable/9/sys/ufs/ufs/ufs_quota.c Wed Feb 29 01:38:36 2012 (r232284) +++ stable/9/sys/ufs/ufs/ufs_quota.c Wed Feb 29 01:39:39 2012 (r232285) @@ -1469,6 +1469,7 @@ dqrele(struct vnode *vp, struct dquot *d if (dq == NODQUOT) return; DQH_LOCK(); + KASSERT(dq->dq_cnt > 0, ("Lost dq %p reference 1", dq)); if (dq->dq_cnt > 1) { dq->dq_cnt--; DQH_UNLOCK(); @@ -1479,6 +1480,7 @@ sync: (void) dqsync(vp, dq); DQH_LOCK(); + KASSERT(dq->dq_cnt > 0, ("Lost dq %p reference 2", dq)); if (--dq->dq_cnt > 0) { DQH_UNLOCK(); @@ -1658,6 +1660,7 @@ quotaref(vp, qrp) */ found = 0; ip = VTOI(vp); + mtx_lock(&dqhlock); for (i = 0; i < MAXQUOTAS; i++) { if ((dq = ip->i_dquot[i]) == NODQUOT) continue; @@ -1665,6 +1668,7 @@ quotaref(vp, qrp) qrp[i] = dq; found++; } + mtx_unlock(&dqhlock); return (found); }