[openib-general] Re: [CM] destroy_cm_id

Sean Hefty mshefty at ichips.intel.com
Tue Mar 1 09:11:55 PST 2005


Libor Michalek wrote:
>   Is it ever allowed to call ib_destroy_cm_id() from a CM callback?
> For some reason I thought that this was OK from only the IDLE callback,
> but if I destroy from IDLE I get a hang on cm_id_priv->lock, I believe.
> Should the normal mode of operation in the case be to return an error
> from IDLE to ensure that cm_id gets cleaned-up?

You cannot call ib_destroy_cm_id from a callback.  A reference is held 
on the cm_id while the callback is in progress, so the call to 
ib_destroy_cm_id will always block forever.  The solution is to return 
a non-zero value from the callback itself, which will destroy the cm_id.

Note that you can destroy the cm_id at anytime.  You don't need to wait 
for it to transition to IDLE.  (The CM maintains the timewait state 
separate from the cm_id itself.)

- Sean



More information about the general mailing list