[openib-general] [PATCH/RFC] IB/mad: Fix race between cancel and receive

Jack Morgenstein jackm at dev.mellanox.co.il
Tue Nov 7 07:32:36 PST 2006


On Tuesday 07 November 2006 17:25, Roland Dreier wrote:
>     Jack> I think you're correct architecturally regarding generating
>     Jack> receive callbacks for cancelled sends.  You need to check,
>     Jack> though, that the above change does not result in memory
>     Jack> leaks or broken logic.
> 
>     Jack> For example, in ipoib_main.c:ipoib_flush_paths(), If there
>     Jack> is an outstanding query, ib_sa_cancel_query gets called.
>     Jack> The code then goes on to wait_for_completion() anyway
>     Jack> (assuming that even a cancelled query will result in a
>     Jack> callback).
> 
> Yes, this is exactly what my patch tries to do: make sure that every
> SA query generates exactly one callback.  The race I described is a
> case where the MAD layer might cause two callbacks for the same
> query, but I believe that with my change every query will generate one
> callback.  Do you see a problem with it?
> 
>  - R.
> 
On a second examination (prompted by Michael Tsirkin), I see that your patch
is fine.  It only prevents (in the receive completion handler) generating a
spurious callback for cancelled but as yet unprocessed queries.

- Jack




More information about the general mailing list