diff options
author | rwatson <rwatson@FreeBSD.org> | 2004-06-24 02:01:48 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2004-06-24 02:01:48 +0000 |
commit | 93baf0b01a4613cd177b1fd2c4b2c26f01456e94 (patch) | |
tree | 8bec5c7d28a474674be9c4a8c3f3bb95c2a1f3c5 /sys/netinet/in_pcb.h | |
parent | ed101b4b5dfc35305d7862e8bbf648325eee5d46 (diff) | |
download | FreeBSD-src-93baf0b01a4613cd177b1fd2c4b2c26f01456e94.zip FreeBSD-src-93baf0b01a4613cd177b1fd2c4b2c26f01456e94.tar.gz |
When asserting non-Giant locks in the network stack, also assert
Giant if debug.mpsafenet=0, as any points that require synchronization
in the SMPng world also required it in the Giant-world:
- inpcb locks (including IPv6)
- inpcbinfo locks (including IPv6)
- dummynet subsystem lock
- ipfw2 subsystem lock
Diffstat (limited to 'sys/netinet/in_pcb.h')
-rw-r--r-- | sys/netinet/in_pcb.h | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index d1c5413..cf542f6 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -244,9 +244,14 @@ struct inpcbinfo { /* XXX documentation, prefixes */ #define INP_LOCK(inp) mtx_lock(&(inp)->inp_mtx) #define INP_UNLOCK(inp) mtx_unlock(&(inp)->inp_mtx) #ifndef INET6 -#define INP_LOCK_ASSERT(inp) mtx_assert(&(inp)->inp_mtx, MA_OWNED) +#define INP_LOCK_ASSERT(inp) do { \ + mtx_assert(&(inp)->inp_mtx, MA_OWNED); \ + NET_ASSERT_GIANT(); \ +} while (0) #else -#define INP_LOCK_ASSERT(inp) +#define INP_LOCK_ASSERT(inp) do { \ + NET_ASSERT_GIANT(); \ +} while (0) #endif #define INP_INFO_LOCK_INIT(ipi, d) \ @@ -256,11 +261,21 @@ struct inpcbinfo { /* XXX documentation, prefixes */ #define INP_INFO_RUNLOCK(ipi) mtx_unlock(&(ipi)->ipi_mtx) #define INP_INFO_WUNLOCK(ipi) mtx_unlock(&(ipi)->ipi_mtx) #ifndef INET6 -#define INP_INFO_RLOCK_ASSERT(ipi) mtx_assert(&(ipi)->ipi_mtx, MA_OWNED) -#define INP_INFO_WLOCK_ASSERT(ipi) mtx_assert(&(ipi)->ipi_mtx, MA_OWNED) +#define INP_INFO_RLOCK_ASSERT(ipi) do { \ + mtx_assert(&(ipi)->ipi_mtx, MA_OWNED); \ + NET_ASSERT_GIANT(); \ +} while (0) +#define INP_INFO_WLOCK_ASSERT(ipi) do { \ + mtx_assert(&(ipi)->ipi_mtx, MA_OWNED); \ + NET_ASSERT_GIANT(); \ +} while (0) #else -#define INP_INFO_RLOCK_ASSERT(ipi) -#define INP_INFO_WLOCK_ASSERT(ipi) +#define INP_INFO_RLOCK_ASSERT(ipi) do { \ + NET_ASSERT_GIANT(); \ +} while (0) +#define INP_INFO_WLOCK_ASSERT(ipi) do { \ + NET_ASSERT_GIANT(); \ +} while (0) #endif #define INP_PCBHASH(faddr, lport, fport, mask) \ |