From owner-cvs-all@FreeBSD.ORG Wed Feb 13 20:44:21 2008 Return-Path: Delivered-To: cvs-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9907816A41A; Wed, 13 Feb 2008 20:44:21 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 8D25513C468; Wed, 13 Feb 2008 20:44:21 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m1DKiLE4036481; Wed, 13 Feb 2008 20:44:21 GMT (envelope-from attilio@repoman.freebsd.org) Received: (from attilio@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m1DKiKXT036480; Wed, 13 Feb 2008 20:44:20 GMT (envelope-from attilio) Message-Id: <200802132044.m1DKiKXT036480@repoman.freebsd.org> From: Attilio Rao Date: Wed, 13 Feb 2008 20:44:19 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/gnu/fs/xfs/FreeBSD xfs_buf.c src/sys/kern kern_lock.c vfs_bio.c src/sys/nfs4client nfs4_vnops.c src/sys/nfsclient nfs_vnops.c src/sys/sys buf.h lock.h lockmgr.h X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Feb 2008 20:44:21 -0000 attilio 2008-02-13 20:44:19 UTC FreeBSD src repository Modified files: sys/gnu/fs/xfs/FreeBSD xfs_buf.c sys/kern kern_lock.c vfs_bio.c sys/nfs4client nfs4_vnops.c sys/nfsclient nfs_vnops.c sys/sys buf.h lock.h lockmgr.h Log: - Add real assertions to lockmgr locking primitives. A couple of notes for this: * WITNESS support, when enabled, is only used for shared locks in order to avoid problems with the "disowned" locks * KA_HELD and KA_UNHELD only exists in the lockmgr namespace in order to assert for a generic thread (not curthread) owning or not the lock. Really, this kind of check is bogus but it seems very widespread in the consumers code. So, for the moment, we cater this untrusted behaviour, until the consumers are not fixed and the options could be removed (hopefully during 8.0-CURRENT lifecycle) * Implementing KA_HELD and KA_UNHELD (not surported natively by WITNESS) made necessary the introduction of LA_MASKASSERT which specifies the range for default lock assertion flags * About other aspects, lockmgr_assert() follows exactly what other locking primitives offer about this operation. - Build real assertions for buffer cache locks on the top of lockmgr_assert(). They can be used with the BUF_ASSERT_*(bp) paradigm. - Add checks at lock destruction time and use a cookie for verifying lock integrity at any operation. - Redefine BUF_LOCKFREE() in order to not use a direct assert but let it rely on the aforementioned destruction time check. KPI results evidently broken, so __FreeBSD_version bumping and manpage update result necessary and will be committed soon. Side note: lockmgr_assert() will be used soon in order to implement real assertions in the vnode namespace replacing the legacy and still bogus "VOP_ISLOCKED()" way. Tested by: kris (earlier version) Reviewed by: jhb Revision Changes Path 1.4 +3 -5 src/sys/gnu/fs/xfs/FreeBSD/xfs_buf.c 1.124 +117 -28 src/sys/kern/kern_lock.c 1.536 +11 -13 src/sys/kern/vfs_bio.c 1.41 +2 -3 src/sys/nfs4client/nfs4_vnops.c 1.281 +2 -3 src/sys/nfsclient/nfs_vnops.c 1.200 +27 -6 src/sys/sys/buf.h 1.71 +1 -0 src/sys/sys/lock.h 1.62 +24 -0 src/sys/sys/lockmgr.h