From owner-svn-src-head@FreeBSD.ORG Tue Nov 4 18:56:12 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C00141065679; Tue, 4 Nov 2008 18:56:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ADD848FC2A; Tue, 4 Nov 2008 18:56:12 +0000 (UTC) (envelope-from jhb@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 mA4IuCuE004915; Tue, 4 Nov 2008 18:56:12 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mA4IuCli004914; Tue, 4 Nov 2008 18:56:12 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200811041856.mA4IuCli004914@svn.freebsd.org> From: John Baldwin Date: Tue, 4 Nov 2008 18:56:12 +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: r184651 - head/sys/ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Nov 2008 18:56:12 -0000 Author: jhb Date: Tue Nov 4 18:56:12 2008 New Revision: 184651 URL: http://svn.freebsd.org/changeset/base/184651 Log: Quiet a WITNESS warning with the dirhash sx locks by setting the DUPOK flag. Specifically, if two threads race to create a dirhash for a directory, then one might already have created a private dirhash structure (and locked it) when it realizes the directory now has a structure and tries to lock that one. Modified: head/sys/ufs/ufs/ufs_dirhash.c Modified: head/sys/ufs/ufs/ufs_dirhash.c ============================================================================== --- head/sys/ufs/ufs/ufs_dirhash.c Tue Nov 4 18:54:44 2008 (r184650) +++ head/sys/ufs/ufs/ufs_dirhash.c Tue Nov 4 18:56:12 2008 (r184651) @@ -181,7 +181,16 @@ ufsdirhash_create(struct inode *ip) if (ndh == NULL) return (NULL); refcount_init(&ndh->dh_refcount, 1); - sx_init(&ndh->dh_lock, "dirhash"); + + /* + * The DUPOK is to prevent warnings from the + * sx_slock() a few lines down which is safe + * since the duplicate lock in that case is + * the one for this dirhash we are creating + * now which has no external references until + * after this function returns. + */ + sx_init_flags(&ndh->dh_lock, "dirhash", SX_DUPOK); sx_xlock(&ndh->dh_lock); } /*