From owner-svn-src-head@FreeBSD.ORG Sun Jun 7 20:38:42 2009 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 87CC6106566C; Sun, 7 Jun 2009 20:38:42 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 760068FC15; Sun, 7 Jun 2009 20:38:42 +0000 (UTC) (envelope-from rmacklem@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 n57KcgYV004765; Sun, 7 Jun 2009 20:38:42 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n57KcgwH004764; Sun, 7 Jun 2009 20:38:42 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200906072038.n57KcgwH004764@svn.freebsd.org> From: Rick Macklem Date: Sun, 7 Jun 2009 20:38:42 +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: r193649 - head/sys/rpc 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: Sun, 07 Jun 2009 20:38:43 -0000 Author: rmacklem Date: Sun Jun 7 20:38:41 2009 New Revision: 193649 URL: http://svn.freebsd.org/changeset/base/193649 Log: Add a check to xprt_unregister() to catch the case where another thread has already unregistered the structure. Also add a KASSERT() to xprt_unregister_locked() to check that the structure hasn't already been unregistered. Reviewed by: jhb Tested by: pho Approved by: kib (mentor) Modified: head/sys/rpc/svc.c Modified: head/sys/rpc/svc.c ============================================================================== --- head/sys/rpc/svc.c Sun Jun 7 20:12:14 2009 (r193648) +++ head/sys/rpc/svc.c Sun Jun 7 20:38:41 2009 (r193649) @@ -293,6 +293,8 @@ xprt_unregister_locked(SVCXPRT *xprt) { SVCPOOL *pool = xprt->xp_pool; + KASSERT(xprt->xp_registered == TRUE, + ("xprt_unregister_locked: not registered")); if (xprt->xp_active) { TAILQ_REMOVE(&pool->sp_active, xprt, xp_alink); xprt->xp_active = FALSE; @@ -307,6 +309,11 @@ xprt_unregister(SVCXPRT *xprt) SVCPOOL *pool = xprt->xp_pool; mtx_lock(&pool->sp_lock); + if (xprt->xp_registered == FALSE) { + /* Already unregistered by another thread */ + mtx_unlock(&pool->sp_lock); + return; + } xprt_unregister_locked(xprt); mtx_unlock(&pool->sp_lock);