From ca47fccd6b260693108c5ee5634bd0e011c67f5e Mon Sep 17 00:00:00 2001 From: rwatson Date: Thu, 17 Apr 2008 21:38:18 +0000 Subject: Convert pcbinfo and inpcb mutexes to rwlocks, and modify macros to explicitly select write locking for all use of the inpcb mutex. Update some pcbinfo lock assertions to assert locked rather than write-locked, although in practice almost all uses of the pcbinfo rwlock main exclusive, and all instances of inpcb lock acquisition are exclusive. This change should introduce (ideally) little functional change. However, it lays the groundwork for significantly increased parallelism in the TCP/IP code. MFC after: 3 months Tested by: kris (superset of committered patch) --- sys/contrib/pf/net/pf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/contrib/pf') diff --git a/sys/contrib/pf/net/pf.c b/sys/contrib/pf/net/pf.c index 69a7de5..69fe3de 100644 --- a/sys/contrib/pf/net/pf.c +++ b/sys/contrib/pf/net/pf.c @@ -2915,7 +2915,7 @@ pf_socket_lookup(int direction, struct pf_pdesc *pd) pd->lookup.pid = NO_PID; /* XXX: revisit */ #ifdef __FreeBSD__ if (inp_arg != NULL) { - INP_LOCK_ASSERT(inp_arg); + INP_WLOCK_ASSERT(inp_arg); if (inp_arg->inp_socket) { pd->lookup.uid = inp_arg->inp_socket->so_cred->cr_uid; pd->lookup.gid = @@ -3018,15 +3018,15 @@ pf_socket_lookup(int direction, struct pf_pdesc *pd) return (-1); } #ifdef __FreeBSD__ - INP_LOCK(inp); + INP_WLOCK(inp); if ((inp->inp_socket == NULL) || (inp->inp_socket->so_cred == NULL)) { - INP_UNLOCK(inp); + INP_WUNLOCK(inp); INP_INFO_RUNLOCK(pi); return (-1); } pd->lookup.uid = inp->inp_socket->so_cred->cr_uid; pd->lookup.gid = inp->inp_socket->so_cred->cr_groups[0]; - INP_UNLOCK(inp); + INP_WUNLOCK(inp); INP_INFO_RUNLOCK(pi); #else pd->lookup.uid = inp->inp_socket->so_euid; -- cgit v1.1