From: Matt Benjamin Date: Wed, 25 Aug 2010 20:19:18 +0000 (-0400) Subject: FBSD: give osi_NetReceive time to shutdown, reprise X-Git-Tag: openafs-devel-1_5_77~35 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=fe0ba8419395bb6594c9c9d1747d8cfe59b2398a;p=packages%2Fo%2Fopenafs.git FBSD: give osi_NetReceive time to shutdown, reprise The delay logic needs to follow soshutdown, and precede soclose. The thread in osi_NetReceive is racing to do another soreceive. That thread needs to win the race and notice the socket is shut down before rx_socket is torn down. Change-Id: Id8424dcfa2498550a190d277017b7ea15fc11023 Reviewed-on: http://gerrit.openafs.org/2613 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry picked from commit 2ea508ea0f320ca17de6df3526aa7237b998c7be) Reviewed-on: http://gerrit.openafs.org/2678 --- diff --git a/src/rx/FBSD/rx_knet.c b/src/rx/FBSD/rx_knet.c index 7579fdc29..187ee4c87 100644 --- a/src/rx/FBSD/rx_knet.c +++ b/src/rx/FBSD/rx_knet.c @@ -87,7 +87,6 @@ osi_StopListener(void) if (haveGlock) AFS_GUNLOCK(); soshutdown(rx_socket, SHUT_RDWR); - soclose(rx_socket); p = pfind(rxk_ListenerPid); afs_warn("osi_StopListener: rxk_ListenerPid %lx\n", p); if (p) @@ -104,12 +103,13 @@ osi_StopListener(void) MUTEX_ENTER(&s_mtx); tries = 3; while ((tries > 0) && (!so_is_disconn(rx_socket))) { + afs_warn("osi_StopListener: waiting (%d) ", tries); msleep(&osi_StopListener, &s_mtx, PSOCK | PCATCH, "rx_shutdown_timedwait", 1 * hz); --tries; } if (so_is_disconn(rx_socket)) - soclose(rx_socket); + soclose(rx_socket); MUTEX_EXIT(&s_mtx); MUTEX_DESTROY(&s_mtx); }