[openib-general] Re: user_mad.c: deadlock?

Michael S. Tsirkin mst at mellanox.co.il
Wed Nov 9 05:56:35 PST 2005


Quoting r. Roland Dreier <rolandd at cisco.com>:
> Subject: Re: user_mad.c: deadlock?
> 
>     Michael> It seems, therefore, that we can have a deadlock inside
>     Michael> user_mad, where ib_umad_close calls
>     Michael> ib_unregister_mad_agent which blocks until send_handler
>     Michael> runs which is blocked by the port mutex.
> 
> It certainly looks that way, and it also looks like
> ib_umad_unreg_agent() has had the same potential deadlock for a
> while.  In any case, I don't see any reason to hold the port mutex
> while unregistering agents in ib_umad_close() (the file is already
> gone, so it can't race against userspace registering or unregistering
> MAD agents via ioctl).  So something like this should be good enough.
> 
> Does anyone see anything wrong with this?
> 
>  - R.

What about ib_umad_reg_agent error handling code in ib_umad_reg_agent?
That seems to still call ib_umad_unreg_agent from under the down_write.
And what about ib_umad_kill_port, which also does this?
What prevents the deadlock in these two cases?

-- 
MST



More information about the general mailing list