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)
This commit is contained in:
rmacklem 2009-06-07 20:38:41 +00:00
parent d754678fa9
commit 8fb24ef4a3

View File

@ -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);