From owner-svn-src-stable-7@FreeBSD.ORG Tue Dec 9 16:30:41 2008 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E01BE1065676; Tue, 9 Dec 2008 16:30:41 +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 97D4E8FC36; Tue, 9 Dec 2008 16:30:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB9GUf8K095812; Tue, 9 Dec 2008 16:30:41 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB9GUf7L095811; Tue, 9 Dec 2008 16:30:41 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200812091630.mB9GUf7L095811@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 9 Dec 2008 16:30:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185798 - in stable/7/sys: . contrib/pf ufs/ufs X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2008 16:30:42 -0000 Author: kib Date: Tue Dec 9 16:30:41 2008 New Revision: 185798 URL: http://svn.freebsd.org/changeset/base/185798 Log: MFC r185761: Recheck the DQ_MOD after the dqh lock is relocked. Repeat dqsync() if the dq is dirty. This ensures that up to date dq is written in the quota file and fixes assertion in dqget(). Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/ufs/ufs/ufs_quota.c Modified: stable/7/sys/ufs/ufs/ufs_quota.c ============================================================================== --- stable/7/sys/ufs/ufs/ufs_quota.c Tue Dec 9 16:25:46 2008 (r185797) +++ stable/7/sys/ufs/ufs/ufs_quota.c Tue Dec 9 16:30:41 2008 (r185798) @@ -1321,7 +1321,7 @@ dqrele(vp, dq) return; } DQH_UNLOCK(); - +sync: (void) dqsync(vp, dq); DQH_LOCK(); @@ -1330,6 +1330,18 @@ dqrele(vp, dq) DQH_UNLOCK(); return; } + + /* + * The dq may become dirty after it is synced but before it is + * put to the free list. Checking the DQ_MOD there without + * locking dq should be safe since no other references to the + * dq exist. + */ + if ((dq->dq_flags & DQ_MOD) != 0) { + dq->dq_cnt++; + DQH_UNLOCK(); + goto sync; + } TAILQ_INSERT_TAIL(&dqfreelist, dq, dq_freelist); DQH_UNLOCK(); }