From owner-svn-src-all@FreeBSD.ORG Fri Dec 19 14:33:30 2008 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 2B187106564A; Fri, 19 Dec 2008 14:33:30 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1BC588FC12; Fri, 19 Dec 2008 14:33:30 +0000 (UTC) (envelope-from trasz@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 mBJEXTZi074329; Fri, 19 Dec 2008 14:33:29 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBJEXTbF074328; Fri, 19 Dec 2008 14:33:29 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200812191433.mBJEXTbF074328@svn.freebsd.org> From: Edward Tomasz Napierala Date: Fri, 19 Dec 2008 14:33:29 +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: r186320 - head/sys/cam 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: Fri, 19 Dec 2008 14:33:30 -0000 Author: trasz Date: Fri Dec 19 14:33:29 2008 New Revision: 186320 URL: http://svn.freebsd.org/changeset/base/186320 Log: Fix cam_sim_free() wakeup condition and add mtx_asserts. Submitted by: Christoph Mallon Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: head/sys/cam/cam_sim.c Modified: head/sys/cam/cam_sim.c ============================================================================== --- head/sys/cam/cam_sim.c Fri Dec 19 14:31:40 2008 (r186319) +++ head/sys/cam/cam_sim.c Fri Dec 19 14:33:29 2008 (r186320) @@ -123,9 +123,10 @@ void cam_sim_release(struct cam_sim *sim) { KASSERT(sim->refcount >= 1, ("sim->refcount >= 1")); + mtx_assert(sim->mtx, MA_OWNED); sim->refcount--; - if (sim->refcount <= 1) + if (sim->refcount == 0) wakeup(sim); } @@ -133,6 +134,7 @@ void cam_sim_hold(struct cam_sim *sim) { KASSERT(sim->refcount >= 1, ("sim->refcount >= 1")); + mtx_assert(sim->mtx, MA_OWNED); sim->refcount++; }