Marcio Barbosa 2a011abc47 afs: release the packets used by rx on shutdown
When the OpenAFS client is unmounted on DARWIN, the blocks of packets
allocated by RX are released. Historically, the memory used by those
packets was never properly released.

Before 230dcebcd61064cc9aab6d20d34ff866a5c575ea, only the last block of
packets used to be released:

...
struct rx_packet *rx_mallocedP = 0;
...
void
rxi_MorePackets(int apackets)
{
    ...
    getme = apackets * sizeof(struct rx_packet);
    p = rx_mallocedP = (struct rx_packet *)osi_Alloc(getme);
    ...
}
...
void
rxi_FreeAllPackets(void)
{
    ...
    osi_Free(rx_mallocedP, ...);
    ...
}
...

As we can see, ‘rx_mallocedP’ is a global pointer that stores the
first address of the last allocated block of packets. As a result, when
‘rxi_FreeAllPackets’ is called, only the last block is released.

However, 230dcebcd61064cc9aab6d20d34ff866a5c575ea moved the global
pointer in question to the end of the last block. As a result, when the
OpenAFS client is unmounted on DARWIN, the ‘rxi_FreeAllPackets’
function releases the wrong block of memory. This problem was exposed
on OS X 10.12 Sierra where the system crashes when the OpenAFS client
is unmounted.

To fix this problem, store the address of every single block of packets
in a queue and release one by one when the OpenAFS client is unmounted.

Reviewed-on: https://gerrit.openafs.org/12427
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 5b28061fb593f5f48df549b07f0ccd848348b93c)

Change-Id: Id8606b1c1444861df69ed4af8169e343964a691d
Reviewed-on: https://gerrit.openafs.org/12602
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2017-05-25 13:49:48 -04:00
..
2015-10-07 06:11:49 -04:00
2011-02-27 03:24:31 -08:00
2017-03-02 04:37:44 -05:00
2017-03-16 13:41:04 -04:00
2010-08-16 21:32:53 -07:00
2010-05-24 21:45:22 -07:00
2011-04-28 20:26:11 -07:00
2010-08-16 21:32:53 -07:00
2017-03-02 04:37:44 -05:00
2013-11-06 07:16:56 -08:00
2013-03-22 06:00:21 -07:00
2017-03-02 04:37:44 -05:00
2017-03-02 04:37:44 -05:00
2010-08-16 21:32:53 -07:00
2011-05-03 03:46:58 -07:00
2017-03-02 04:37:44 -05:00
2014-06-03 12:26:50 -04:00
2013-03-22 07:09:51 -07:00
2017-03-02 04:37:44 -05:00
2010-11-03 03:48:05 -07:00
2016-04-06 04:12:49 -04:00
2015-10-07 06:19:55 -04:00
2017-03-02 04:37:44 -05:00
2010-08-16 21:32:53 -07:00
2017-03-02 04:37:44 -05:00
2017-05-25 13:48:06 -04:00
2017-03-02 04:37:44 -05:00
2016-04-13 10:31:53 -04:00
2010-06-15 16:30:04 -07:00
2010-07-06 08:16:25 -07:00
2010-07-08 08:48:43 -07:00