This is a note to let you know that I've just added the patch titled

    iser-target: Fix post_send_buf_count for RDMA READ/WRITE

to the 3.10-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     iser-target-fix-post_send_buf_count-for-rdma-read-write.patch
and it can be found in the queue-3.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From b6b87a1df604678ed1be40158080db012a99ccca Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <[email protected]>
Date: Thu, 27 Feb 2014 09:05:03 -0800
Subject: iser-target: Fix post_send_buf_count for RDMA READ/WRITE

From: Nicholas Bellinger <[email protected]>

commit b6b87a1df604678ed1be40158080db012a99ccca upstream.

This patch fixes the incorrect setting of ->post_send_buf_count
related to RDMA WRITEs + READs where isert_rdma_rw->send_wr_num
was not being taken into account.

This includes incrementing ->post_send_buf_count within
isert_put_datain() + isert_get_dataout(), decrementing within
__isert_send_completion() + isert_response_completion(), and
clearing wr->send_wr_num within isert_completion_rdma_read()

This is necessary because even though IB_SEND_SIGNALED is
not set for RDMA WRITEs + READs, during a QP failure event
the work requests will be returned with exception status
from the TX completion queue.

Acked-by: Sagi Grimberg <[email protected]>
Cc: Or Gerlitz <[email protected]>
Signed-off-by: Nicholas Bellinger <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>


---
 drivers/infiniband/ulp/isert/ib_isert.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -1308,6 +1308,7 @@ isert_completion_rdma_read(struct iser_t
        }
 
        cmd->write_data_done = se_cmd->data_length;
+       wr->send_wr_num = 0;
 
        pr_debug("isert_do_rdma_read_comp, calling target_execute_cmd\n");
        spin_lock_bh(&cmd->istate_lock);
@@ -1367,6 +1368,7 @@ isert_response_completion(struct iser_tx
                          struct ib_device *ib_dev)
 {
        struct iscsi_cmd *cmd = &isert_cmd->iscsi_cmd;
+       struct isert_rdma_wr *wr = &isert_cmd->rdma_wr;
 
        if (cmd->i_state == ISTATE_SEND_TASKMGTRSP ||
            cmd->i_state == ISTATE_SEND_LOGOUTRSP ||
@@ -1377,7 +1379,7 @@ isert_response_completion(struct iser_tx
                queue_work(isert_comp_wq, &isert_cmd->comp_work);
                return;
        }
-       atomic_dec(&isert_conn->post_send_buf_count);
+       atomic_sub(wr->send_wr_num + 1, &isert_conn->post_send_buf_count);
 
        cmd->i_state = ISTATE_SENT_STATUS;
        isert_completion_put(tx_desc, isert_cmd, ib_dev);
@@ -1415,7 +1417,7 @@ isert_send_completion(struct iser_tx_des
        case ISER_IB_RDMA_READ:
                pr_debug("isert_send_completion: Got ISER_IB_RDMA_READ:\n");
 
-               atomic_dec(&isert_conn->post_send_buf_count);
+               atomic_sub(wr->send_wr_num, &isert_conn->post_send_buf_count);
                isert_completion_rdma_read(tx_desc, isert_cmd);
                break;
        default:
@@ -1834,12 +1836,12 @@ isert_put_datain(struct iscsi_conn *conn
        isert_init_tx_hdrs(isert_conn, &isert_cmd->tx_desc);
        isert_init_send_wr(isert_cmd, &isert_cmd->tx_desc.send_wr);
 
-       atomic_inc(&isert_conn->post_send_buf_count);
+       atomic_add(wr->send_wr_num + 1, &isert_conn->post_send_buf_count);
 
        rc = ib_post_send(isert_conn->conn_qp, wr->send_wr, &wr_failed);
        if (rc) {
                pr_warn("ib_post_send() failed for IB_WR_RDMA_WRITE\n");
-               atomic_dec(&isert_conn->post_send_buf_count);
+               atomic_sub(wr->send_wr_num + 1, 
&isert_conn->post_send_buf_count);
        }
        pr_debug("Posted RDMA_WRITE + Response for iSER Data READ\n");
        return 1;
@@ -1942,12 +1944,12 @@ isert_get_dataout(struct iscsi_conn *con
                data_left -= data_len;
        }
 
-       atomic_inc(&isert_conn->post_send_buf_count);
+       atomic_add(wr->send_wr_num, &isert_conn->post_send_buf_count);
 
        rc = ib_post_send(isert_conn->conn_qp, wr->send_wr, &wr_failed);
        if (rc) {
                pr_warn("ib_post_send() failed for IB_WR_RDMA_READ\n");
-               atomic_dec(&isert_conn->post_send_buf_count);
+               atomic_sub(wr->send_wr_num, &isert_conn->post_send_buf_count);
        }
        pr_debug("Posted RDMA_READ memory for ISER Data WRITE\n");
        return 0;


Patches currently in stable-queue which might be from [email protected] are

queue-3.10/iscsi-iser-target-fix-isert_conn-state-hung-shutdown-issues.patch
queue-3.10/iscsi-target-fix-iscsit_get_tpg_from_np-tpg_state-bug.patch
queue-3.10/bio-integrity-fix-bio_integrity_verify-segment-start-bug.patch
queue-3.10/iser-target-fix-post_send_buf_count-for-rdma-read-write.patch
queue-3.10/iscsi-iser-target-use-list_del_init-for-i_conn_node.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to