Skip to content

Commit

Permalink
IB/ipath: Fix hang on module unload
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Yannick Cote authored and Roland Dreier committed Sep 30, 2008
1 parent 9403589 commit e441d63
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/infiniband/hw/ipath/ipath_verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e441d63

Please sign in to comment.