From b1221143e4327b567983e2a731a40814698ec783 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Fri, 11 Sep 2009 01:59:08 -0400 Subject: [PATCH] darwin knet avoid rx socket during shutdown theoretically a user thread can race us during shutdown and end up panicing us if the soclose happens at the wrong time. if we're shutting down just return. using afs_shuttingdown would have the side effect that we'd lose the ability to add any graceful behavior. Reviewed-on: http://gerrit.openafs.org/443 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry picked from commit 3898524693e7297e228ded03f34125558f225d58) Change-Id: I45c3d1a773150ada018a4867139273053f989f57 Reviewed-on: http://gerrit.openafs.org/959 --- src/rx/DARWIN/rx_knet.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/rx/DARWIN/rx_knet.c b/src/rx/DARWIN/rx_knet.c index 8f8f623c9..35f26b359 100644 --- a/src/rx/DARWIN/rx_knet.c +++ b/src/rx/DARWIN/rx_knet.c @@ -45,6 +45,11 @@ osi_NetReceive(osi_socket so, struct sockaddr_in *addr, struct iovec *dvec, for (i = 0; i < nvecs; i++) iov[i] = dvec[i]; + + if ((afs_termState == AFSOP_STOP_RXK_LISTENER) || + (afs_termState == AFSOP_STOP_COMPLETE)) + return -1; + if (haveGlock) AFS_GUNLOCK(); #if defined(KERNEL_FUNNEL) @@ -178,8 +183,13 @@ osi_NetSend(osi_socket so, struct sockaddr_in *addr, struct iovec *dvec, addr->sin_len = sizeof(struct sockaddr_in); + if ((afs_termState == AFSOP_STOP_RXK_LISTENER) || + (afs_termState == AFSOP_STOP_COMPLETE)) + return -1; + if (haveGlock) AFS_GUNLOCK(); + #if defined(KERNEL_FUNNEL) thread_funnel_switch(KERNEL_FUNNEL, NETWORK_FUNNEL); #endif -- 2.39.5