Date: Sun, 7 Jun 2009 20:38:42 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r193649 - head/sys/rpc Message-ID: <200906072038.n57KcgwH004764@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906072038.n57KcgwH004764>