Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ead595aeb0974171eddd012df115424752413c26
Commit:     ead595aeb0974171eddd012df115424752413c26
Parent:     11e75a7455a7bc73e752c0c985986c2b1f8c930a
Author:     Sean Hefty <[EMAIL PROTECTED]>
AuthorDate: Wed Feb 13 14:33:53 2008 -0800
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Thu Feb 14 15:30:41 2008 -0800

    RDMA/cma: Do not issue MRA if user rejects connection request
    
    There's an undesirable interaction with issuing MRA requests to
    increase connection timeouts and the listen backlog.
    
    When the rdma_cm receives a connection request, it queues an MRA with
    the ib_cm.  (The ib_cm will send an MRA if it receives a duplicate
    REQ.)  The rdma_cm will then create a new rdma_cm_id and give that to
    the user, which in this case is the rdma_user_cm.
    
    If the listen backlog maintained in the rdma_user_cm is full, it
    destroys the rdma_cm_id, which in turns destroys the ib_cm_id.  The
    ib_cm_id generates a REJ because the state of the ib_cm_id has changed
    to MRA sent, versus REQ received.  When the backlog is full, we just
    want to drop the REQ so that it is retried later.
    
    Fix this by deferring queuing the MRA until after the user of the
    rdma_cm has examined the connection request.
    
    Signed-off-by: Sean Hefty <[EMAIL PROTECTED]>
    Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/core/cma.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 1eff1b2..34507da 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1107,7 +1107,6 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct 
ib_cm_event *ib_event)
                event.param.ud.private_data_len =
                                IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE - offset;
        } else {
-               ib_send_cm_mra(cm_id, CMA_CM_MRA_SETTING, NULL, 0);
                conn_id = cma_new_conn_id(&listen_id->id, ib_event);
                cma_set_req_event_data(&event, &ib_event->param.req_rcvd,
                                       ib_event->private_data, offset);
@@ -1130,6 +1129,15 @@ static int cma_req_handler(struct ib_cm_id *cm_id, 
struct ib_cm_event *ib_event)
 
        ret = conn_id->id.event_handler(&conn_id->id, &event);
        if (!ret) {
+               /*
+                * Acquire mutex to prevent user executing rdma_destroy_id()
+                * while we're accessing the cm_id.
+                */
+               mutex_lock(&lock);
+               if (cma_comp(conn_id, CMA_CONNECT) &&
+                   !cma_is_ud_ps(conn_id->id.ps))
+                       ib_send_cm_mra(cm_id, CMA_CM_MRA_SETTING, NULL, 0);
+               mutex_unlock(&lock);
                cma_enable_remove(conn_id);
                goto out;
        }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to