summaryrefslogtreecommitdiff
path: root/distrib/octeon
diff options
context:
space:
mode:
authorVitaliy Makkoveev <mvs@cvs.openbsd.org>2022-07-01 09:56:18 +0000
committerVitaliy Makkoveev <mvs@cvs.openbsd.org>2022-07-01 09:56:18 +0000
commit330cd6e874a18fa481c8b57a0e30f3850f24e39c (patch)
tree66960465c1d51317668f36763e40af70a3d95ff7 /distrib/octeon
parent02a36ca46695152cacd5ccf441f740f65785e838 (diff)
Make fine grained unix(4) domain sockets locking. Use the per-socket
`so_lock' rwlock(9) instead of global `unp_lock' which locks the whole layer. The PCB of unix(4) sockets are linked to each other and we need to lock them both. This introduces the lock ordering problem, because when the thread (1) keeps lock on `so1' and trying to lock `so2', the thread (2) could hold lock on `so2' and trying to lock `so1'. To solve this we always lock sockets in the strict order. For the sockets which are already accessible from userland, we always lock socket with the smallest memory address first. Sometimes we need to unlock socket before lock it's peer and lock it again. We use reference counters for prevent the connected peer destruction during to relock. We also handle the case where the peer socket was replaced by another socket. For the newly connected sockets, which are not yet exported to the userland by accept(2), we always lock the listening socket `head' first. This allows us to avoid unwanted relock within accept(2) syscall. ok claudio@
Diffstat (limited to 'distrib/octeon')
0 files changed, 0 insertions, 0 deletions