diff options
author | rmacklem <rmacklem@FreeBSD.org> | 2009-06-07 20:38:41 +0000 |
---|---|---|
committer | rmacklem <rmacklem@FreeBSD.org> | 2009-06-07 20:38:41 +0000 |
commit | 8fb24ef4a36b35611bdc3785d1352256ef87ea9a (patch) | |
tree | 7be2da1e46f155adfa61f792d1768c5ce5979fed /sys/rpc | |
parent | d754678fa99b6881e9023055f8e6a42faf83b7ce (diff) | |
download | FreeBSD-src-8fb24ef4a36b35611bdc3785d1352256ef87ea9a.zip FreeBSD-src-8fb24ef4a36b35611bdc3785d1352256ef87ea9a.tar.gz |
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)
Diffstat (limited to 'sys/rpc')
-rw-r--r-- | sys/rpc/svc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/rpc/svc.c b/sys/rpc/svc.c index 5db4c56..8c3bd2c 100644 --- a/sys/rpc/svc.c +++ b/sys/rpc/svc.c @@ -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); |