IB/srp: Fix a race condition triggered by destroying a queue pair
authorBart Van Assche <bvanassche@acm.org>
Tue, 21 Oct 2014 16:00:35 +0000 (18:00 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 12 Nov 2014 11:05:24 +0000 (12:05 +0100)
commit7dad6b2e440d810273946b0e7092a8fe043c3b8a
treecfb1127e6a552d864506126f6dfc6186d8b3357c
parentd92c0da71a35dfddccca7bfa932829504311359e
IB/srp: Fix a race condition triggered by destroying a queue pair

At least LID reassignment can trigger a race condition in the SRP
initiator driver, namely the receive completion handler trying to
post a request on a QP during or after QP destruction and before
the CQ's have been destroyed. Avoid this race by modifying a QP
into the error state and by waiting until all receive completions
have been processed before destroying a QP.

Reported-by: Max Gurtuvoy <maxg@mellanox.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/infiniband/ulp/srp/ib_srp.c
drivers/infiniband/ulp/srp/ib_srp.h