]> git.michaelhowe.org Git - packages/o/openafs.git/commit
rx: prevent connection channel assignment race
authorJeffrey Altman <jaltman@your-file-system.com>
Sun, 10 Jul 2011 02:43:45 +0000 (03:43 +0100)
committerDerrick Brashear <shadow@dementia.org>
Wed, 13 Jul 2011 04:29:32 +0000 (21:29 -0700)
commit8ecd684a33817e94c9671238565a755e5818e753
treecad4ed93cbd765f9374e7468e86e0c5adf77bed1
parent0d344bfd855c0522437328da630de1301ecc51ee
rx: prevent connection channel assignment race

When rx was converted to use pthreads, the code that allocates
a call to a connection channel in rxi_ReceivePacket() was not
made thread safe.  The code prior to this patchset permitted a race
in the server connection case.  The rx_connection channel assignment
in rxi_ReceivePacket() and the call destruction in rxi_FreeCall()
and rxi_DestroyConnectionNoLock() did not consistently protect the
rx_connection channel array using the conn_call_lock.

This race could result in rxi_ReceivePacket() operating on a
rx_call which was disconnected from the previously assigned
rx_connection.

In addition, the code in rxi_ReceivePacket() that was intended
to protect the allocation of a call using rxi_NewCall() to the
connection channel array was racy with itself.

This patchset consistently applies the conn_call_lock to protect
the allocation / deallocation of calls to the connection channel
array and in the process simplifies the logic in rxi_ReceivePacket()
as it is no longer necessary to protect against a null call pointer
since the race can no longer be lost.

(cherry picked from commit 99b43273c0203881ea3d2d50f0abf000cdc0b03e)
Reviewed-on: http://gerrit.openafs.org/4963
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Change-Id: I90ad0dc1f67df2bcaca1da0bb459e730541876cb
Reviewed-on: http://gerrit.openafs.org/4981
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/rx/rx.c