This commit changes the tear-down state machine for sockets and protocols. I have done a moderate amount of testing for several protocol types, but the changes were mechanical for some others, and there are likely bugs. Please let me know (and e-mail current_at_) if you experience any problems. This is part of my continuing project to normalize/sanitize/sanify the life cycle of socket and protocol control blocks in order to make them easier to optimize. Thanks, Robert N M Watson Computer Laboratory University of Cambridge ---------- Forwarded message ---------- Date: Fri, 21 Jul 2006 17:11:15 +0000 (UTC) From: Robert Watson <rwatson_at_FreeBSD.org> To: src-committers_at_FreeBSD.org, cvs-src_at_FreeBSD.org, cvs-all_at_FreeBSD.org Subject: cvs commit: src/sys/kern uipc_socket.c uipc_usrreq.c src/sys/net raw_usrreq.c rtsock.c src/sys/netatalk ddp_usrreq.c src/sys/netatm atm_aal5.c atm_usrreq.c src/sys/netgraph ng_socket.c src/sys/netgraph/bluetooth/include ng_btsocket_hci_raw.h ng_btsocket_l2cap.h ... rwatson 2006-07-21 17:11:15 UTC FreeBSD src repository Modified files: sys/kern uipc_socket.c uipc_usrreq.c sys/net raw_usrreq.c rtsock.c sys/netatalk ddp_usrreq.c sys/netatm atm_aal5.c atm_usrreq.c sys/netgraph ng_socket.c sys/netgraph/bluetooth/include ng_btsocket_hci_raw.h ng_btsocket_l2cap.h ng_btsocket_rfcomm.h sys/netgraph/bluetooth/socket ng_btsocket.c ng_btsocket_hci_raw.c ng_btsocket_l2cap.c ng_btsocket_l2cap_raw.c ng_btsocket_rfcomm.c sys/netinet raw_ip.c tcp_subr.c tcp_usrreq.c udp_usrreq.c sys/netinet6 raw_ip6.c udp6_usrreq.c sys/netipsec keysock.c sys/netipx ipx_usrreq.c spx_usrreq.c sys/netkey keysock.c sys/netnatm natm.c Log: Change semantics of socket close and detach. Add a new protocol switch function, pru_close, to notify protocols that the file descriptor or other consumer of a socket is closing the socket. pru_abort is now a notification of close also, and no longer detaches. pru_detach is no longer used to notify of close, and will be called during socket tear-down by sofree() when all references to a socket evaporate after an earlier call to abort or close the socket. This means detach is now an unconditional teardown of a socket, whereas previously sockets could persist after detach of the protocol retained a reference. This faciliates sharing mutexes between layers of the network stack as the mutex is required during the checking and removal of references at the head of sofree(). With this change, pru_detach can now assume that the mutex will no longer be required by the socket layer after completion, whereas before this was not necessarily true. Reviewed by: gnn Revision Changes Path 1.273 +5 -6 src/sys/kern/uipc_socket.c 1.172 +17 -2 src/sys/kern/uipc_usrreq.c 1.43 +11 -1 src/sys/net/raw_usrreq.c 1.137 +8 -0 src/sys/net/rtsock.c 1.51 +20 -3 src/sys/netatalk/ddp_usrreq.c 1.25 +14 -1 src/sys/netatm/atm_aal5.c 1.27 +1 -0 src/sys/netatm/atm_usrreq.c 1.7 +1 -0 src/sys/netgraph/bluetooth/include/ng_btsocket_hci_raw.h 1.8 +2 -0 src/sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h 1.8 +1 -0 src/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h 1.13 +4 -0 src/sys/netgraph/bluetooth/socket/ng_btsocket.c 1.22 +5 -1 src/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c 1.20 +8 -1 src/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c 1.19 +9 -1 src/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c 1.21 +9 -2 src/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c 1.77 +4 -0 src/sys/netgraph/ng_socket.c 1.164 +34 -15 src/sys/netinet/raw_ip.c 1.252 +12 -37 src/sys/netinet/tcp_subr.c 1.140 +92 -55 src/sys/netinet/tcp_usrreq.c 1.192 +28 -4 src/sys/netinet/udp_usrreq.c 1.64 +21 -3 src/sys/netinet6/raw_ip6.c 1.67 +46 -4 src/sys/netinet6/udp6_usrreq.c 1.16 +12 -0 src/sys/netipsec/keysock.c 1.57 +14 -7 src/sys/netipx/ipx_usrreq.c 1.85 +29 -8 src/sys/netipx/spx_usrreq.c 1.36 +12 -0 src/sys/netkey/keysock.c 1.48 +7 -1 src/sys/netnatm/natm.cReceived on Fri Jul 21 2006 - 15:35:57 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:58 UTC