Bug fix: SRQ availability counter is no longer decremented when ib_post_send() fails.
authorbvassche <bvassche@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Sun, 13 Dec 2009 17:59:44 +0000 (17:59 +0000)
committerbvassche <bvassche@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Sun, 13 Dec 2009 17:59:44 +0000 (17:59 +0000)
git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@1388 d57e44dd-8a1f-0410-8b47-8ef2f437770f

srpt/src/ib_srpt.c

index f787eb4..4800b5c 100644 (file)
@@ -781,7 +781,6 @@ static int srpt_post_send(struct srpt_rdma_ch *ch, struct srpt_ioctx *ioctx,
 
        ret = -ENOMEM;
        if (atomic_dec_return(&ch->qp_wr_avail) < 0) {
-               atomic_inc(&ch->qp_wr_avail);
                PRINT_ERROR("%s[%d]: SRQ full", __func__, __LINE__);
                goto out;
        }
@@ -803,6 +802,8 @@ static int srpt_post_send(struct srpt_rdma_ch *ch, struct srpt_ioctx *ioctx,
        ret = ib_post_send(ch->qp, &wr, &bad_wr);
 
 out:
+       if (ret < 0)
+               atomic_inc(&ch->qp_wr_avail);
        return ret;
 }