summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYannick Cote2008-09-30 06:24:04 +0200
committerRoland Dreier2008-09-30 06:24:04 +0200
commite441d6342890838bfc6d64ca2f0964aca08ae2a2 (patch)
tree94a3fa3aba43ddf3b7381435c347d1699e755ab1
parentIB/ipath: Fix SLID generation for RC/UC QPs when LMC > 0 (diff)
downloadkernel-qcow2-linux-e441d6342890838bfc6d64ca2f0964aca08ae2a2.tar.gz
kernel-qcow2-linux-e441d6342890838bfc6d64ca2f0964aca08ae2a2.tar.xz
kernel-qcow2-linux-e441d6342890838bfc6d64ca2f0964aca08ae2a2.zip
IB/ipath: Fix hang on module unload
Handle the case where posting a send is requested when the link is down. This fixes <https://bugs.openfabrics.org/show_bug.cgi?id=1117>. Signed-off-by: Yannick Cote <yannick.cote@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c
index b766e40e9ebf..eabc4247860b 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c
@@ -340,9 +340,16 @@ static int ipath_post_one_send(struct ipath_qp *qp, struct ib_send_wr *wr)
int acc;
int ret;
unsigned long flags;
+ struct ipath_devdata *dd = to_idev(qp->ibqp.device)->dd;
spin_lock_irqsave(&qp->s_lock, flags);
+ if (qp->ibqp.qp_type != IB_QPT_SMI &&
+ !(dd->ipath_flags & IPATH_LINKACTIVE)) {
+ ret = -ENETDOWN;
+ goto bail;
+ }
+
/* Check that state is OK to post send. */
if (unlikely(!(ib_ipath_state_ops[qp->state] & IPATH_POST_SEND_OK)))
goto bail_inval;