[openib-general] [PATCH] ib_mad: In ib_mad_complete_recv, decrement agent refcount when not fully reassembled and when no request found

Sean Hefty mshefty at ichips.intel.com
Mon Oct 25 11:22:25 PDT 2004


On Mon, 25 Oct 2004 13:35:05 -0400
Hal Rosenstock <halr at voltaire.com> wrote:

> > I think that we want this to be atomic_dec_and_test().  
> > (Similar to the call near the end of this function.)  If a match is found, 
> > we can get away with a simple atomic_dec, since the send will still hold a 
> > reference on the mad agent.  But if no match is found, then I think this 
> > may be the last reference being held.
> 
> I didn't change the match path only the non match. It's not the last
> reference held as one other reference is held on the agent which is
> given up at deregistration time.

I only mentioned the match path, since it can rely on another reference being held against the mad_agent from the send.  I.e. the match path and non-match path differ with respect to how many other references are held on the mad_agent.

The reference taken for the receive is made by the MAD layer itself, so the client isn't aware that one was taken.  If the client deregisters the MAD service at the same time that a MAD is received, then the reference from the registration will have been released, leaving only the reference from the receive being held.  So, in the case of a non-match, we need to release the reference, but also check to see if that was the last reference held.

- Sean



More information about the general mailing list