From 8e92d615b3b31e81f40ed2f10f66160772e05038 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Tue, 22 Jan 2013 15:00:29 -0500 Subject: [PATCH] darwin: don't process incoming packets during rx shutdown we have a chicken and egg problem because the kpi doesn't let us kill the upcall before we close a socket. a more correct fix (on master) uses atomics, but for 1.6 this is a minimally-invasive fix, macos only and strictly better than before. FIXES 131577 Change-Id: I6003679f709284ae28f51bf5de8deff873346819 Reviewed-on: http://gerrit.openafs.org/8937 Tested-by: BuildBot Reviewed-by: Stephan Wiesand Reviewed-by: Paul Smeddle --- src/rx/DARWIN/rx_knet.c | 7 +++++++ src/rx/rx.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/rx/DARWIN/rx_knet.c b/src/rx/DARWIN/rx_knet.c index fcf3f3478..b3aa3a2b8 100644 --- a/src/rx/DARWIN/rx_knet.c +++ b/src/rx/DARWIN/rx_knet.c @@ -18,6 +18,8 @@ #endif #ifdef RXK_UPCALL_ENV +extern int rxinit_status; + void rx_upcall(socket_t so, void *arg, __unused int waitflag) { @@ -34,6 +36,11 @@ rx_upcall(socket_t so, void *arg, __unused int waitflag) afs_int32 savelen; /* was using rlen but had aliasing problems */ size_t nbytes, resid, noffset; + /* if rx is shut down, but the socket is not closed yet, we + can't process packets. just return now. */ + if (rxinit_status) + return; + p = rxi_AllocPacket(RX_PACKET_CLASS_RECEIVE); rx_computelen(p, tlen); rx_SetDataSize(p, tlen); /* this is the size of the user data area */ diff --git a/src/rx/rx.c b/src/rx/rx.c index 7982c7794..dfcd3c5c4 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -441,7 +441,7 @@ rx_SetEpoch(afs_uint32 epoch) * by the kernel. Whether this will ever overlap anything in * /etc/services is anybody's guess... Returns 0 on success, -1 on * error. */ -#ifndef AFS_NT40_ENV +#if !(defined(AFS_NT40_ENV) || defined(RXK_UPCALL_ENV)) static #endif int rxinit_status = 1; -- 2.39.5