[openib-general] [PATCH] ib_cancel_mad API

Sean Hefty mshefty at ichips.intel.com
Wed Sep 29 15:03:54 PDT 2004


On Wed, 29 Sep 2004 13:12:36 -0700
Roland Dreier <roland at topspin.com> wrote:

> OK, think about the following scenario.  We're in ib_mad_complete_send_wr():

I understand the scenario that you're describing.  I just think that we've made it easy as it can be for the client already.
 
> and doesn't find the work request, since ib_mad_complete_send_wr() has
> already removed it from the list, so it returns -EINVAL.
> 
> The consumer says, "oh, OK, I have no pending requests so I can free
> my context."  Then the first thread continues and proceeds to call the
> consumer's send_handler function.

Currently, the consumer _only_ has to free their send context in their send MAD completion handler.  No reference counting by the consumer is needed.  And it doesn't matter if a send succeeds, timeouts, has an error, or is canceled.

Clients that try to release their send contexts in both their send handlers and after calling cancel are asking for synchronization issues.

If your refering to a client's mad_agent context, I don't believe that we can support clients who free their context before deregistering (at least not in most usage cases).

- Sean



More information about the general mailing list