From: Derrick Brashear Date: Tue, 22 Jan 2013 20:00:29 +0000 (-0500) Subject: darwin: don't process incoming packets during rx shutdown X-Git-Tag: upstream/1.6.2^2~9 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=0399446de37748aee51af8395203aba6b9712ada;p=packages%2Fo%2Fopenafs.git 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 --- 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;