linux/drivers/infiniband/core
Sean Hefty d02d1f5359 RDMA/cma: Fix deadlock destroying listen requests
Deadlock condition reported by Kanoj Sarcar <kanoj@netxen.com>.
The deadlock occurs when a connection request arrives at the same
time that a wildcard listen is being destroyed.

A wildcard listen maintains per device listen requests for each
RDMA device in the system.  The per device listens are automatically
added and removed when RDMA devices are inserted or removed from
the system.

When a wildcard listen is destroyed, rdma_destroy_id() acquires
the rdma_cm's device mutex ('lock') to protect against hot-plug
events adding or removing per device listens.  It then tries to
destroy the per device listens by calling ib_destroy_cm_id() or
iw_destroy_cm_id().  It does this while holding the device mutex.

However, if the underlying iw/ib CM reports a connection request
while this is occurring, the rdma_cm callback function will try
to acquire the same device mutex.  Since we're in a callback,
the ib_destroy_cm_id() or iw_destroy_cm_id() calls will block until
their callback thread returns, but the callback is blocked waiting for
the device mutex.

Fix this by re-working how per device listens are destroyed.  Use
rdma_destroy_id(), which avoids the deadlock, in place of
cma_destroy_listen().  Additional synchronization is added to handle
device hot-plug events and ensure that the id is not destroyed twice.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2007-10-16 12:25:49 -07:00
..
addr.c RDMA/cma: Use neigh_event_send() to start neighbour discovery 2007-10-09 19:59:13 -07:00
agent.c IB/mad: agent_send_response() should be void 2007-08-03 10:45:17 -07:00
agent.h IB/mad: agent_send_response() should be void 2007-08-03 10:45:17 -07:00
cache.c Detach sched.h from mm.h 2007-05-21 09:18:19 -07:00
cm_msgs.h IB/cm: cm_msgs.h should include ib_cm.h 2007-07-10 21:50:53 -07:00
cm.c IB/cm: Modify interface to send MRAs in response to duplicate messages 2007-10-09 19:59:17 -07:00
cma.c RDMA/cma: Fix deadlock destroying listen requests 2007-10-16 12:25:49 -07:00
core_priv.h [PATCH] IB: move include files to include/rdma 2005-08-26 20:37:38 -07:00
device.c IB: find_first_zero_bit() takes unsigned pointer 2007-10-09 19:59:04 -07:00
fmr_pool.c IB/fmr_pool: Clean up some error messages in fmr_pool.c 2007-10-09 19:59:05 -07:00
iwcm.c PCI: Cleanup the includes of <linux/pci.h> 2007-05-02 19:02:35 -07:00
iwcm.h RDMA: iWARP Connection Manager. 2006-09-22 15:22:46 -07:00
mad_priv.h PCI: Cleanup the includes of <linux/pci.h> 2007-05-02 19:02:35 -07:00
mad_rmpp.c IB/mad: Fix address handle leak in mad_rmpp 2007-08-03 10:45:17 -07:00
mad_rmpp.h [IB] Fix MAD layer DMA mappings to avoid touching data buffer once mapped 2005-10-25 10:51:39 -07:00
mad.c IB/mad: Fix memory leak in switch handling in ib_mad_recv_done_handler() 2007-08-03 10:45:17 -07:00
Makefile IB/uverbs: Export ib_umem_get()/ib_umem_release() to modules 2007-05-08 18:00:37 -07:00
multicast.c IB/core: Fix handling of multicast response failures 2007-10-09 19:59:14 -07:00
packer.c [PATCH] fix remaining missing includes 2005-11-07 07:53:41 -08:00
sa_query.c IB/sa: Add new QoS fields to path record 2007-10-09 19:59:12 -07:00
sa.h IB: Remove garbage non-ASCII characters from comments 2007-07-09 16:17:32 -07:00
smi.c IB/mad: Enhance SMI for switch support 2007-07-09 16:17:32 -07:00
smi.h IB/mad: Enhance SMI for switch support 2007-07-09 16:17:32 -07:00
sysfs.c Driver core: change add_uevent_var to use a struct 2007-10-12 14:51:01 -07:00
ucm.c IB/cm: Include HCA ACK delay in local ACK timeout 2007-07-10 21:50:05 -07:00
ucma.c RDMA/ucma: Allow user space to set service type 2007-10-09 19:59:12 -07:00
ud_header.c [PATCH] fix remaining missing includes 2005-11-07 07:53:41 -08:00
umem.c IB/umem: Add hugetlb flag to struct ib_umem 2007-10-09 19:59:13 -07:00
user_mad.c IB/umad: Fix bit ordering and 32-on-64 problems on big endian systems 2007-10-09 19:59:15 -07:00
uverbs_cmd.c IB/uverbs: Export ib_umem_get()/ib_umem_release() to modules 2007-05-08 18:00:37 -07:00
uverbs_main.c IB/uverbs: Make ib_uverbs_release_event_file() static 2007-10-09 19:59:15 -07:00
uverbs_marshall.c RDMA/cma: Export rdma cm interface to userspace 2006-12-12 11:50:22 -08:00
uverbs.h IB/uverbs: Make ib_uverbs_release_event_file() static 2007-10-09 19:59:15 -07:00
verbs.c IB: Add CQ comp_vector support 2007-05-06 21:18:11 -07:00