ib_srpt: race-at-session-unregistration-fix (partially reverted r2339).

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2342 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2010-10-02 17:45:57 +00:00
parent c935c8e28d
commit c130e11f44
2 changed files with 7 additions and 0 deletions
+6
View File
@@ -2055,6 +2055,7 @@ static void srpt_completion(struct ib_cq *cq, void *ctx)
{
struct srpt_rdma_ch *ch = ctx;
atomic_inc(&ch->processing_compl);
switch (thread) {
case MODE_IB_COMPLETION_IN_THREAD:
wake_up_interruptible(&ch->wait_queue);
@@ -2066,6 +2067,7 @@ static void srpt_completion(struct ib_cq *cq, void *ctx)
srpt_process_completion(cq, ch, SCST_CONTEXT_TASKLET);
break;
}
atomic_dec(&ch->processing_compl);
}
static int srpt_compl_thread(void *arg)
@@ -2211,6 +2213,9 @@ static void srpt_unregister_channel(struct srpt_rdma_ch *ch)
PRINT_ERROR("Setting queue pair in error state failed: %d",
ret);
while (atomic_read(&ch->processing_compl))
;
/*
* At this point it is guaranteed that no new commands will be sent to
* the SCST core for channel ch, which is a requirement for
@@ -2519,6 +2524,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
ch->sport = &sdev->port[param->port - 1];
ch->cm_id = cm_id;
ch->rq_size = max(SRPT_RQ_SIZE, scst_get_max_lun_commands(NULL, 0));
atomic_set(&ch->processing_compl, 0);
atomic_set(&ch->state, RDMA_CHANNEL_CONNECTING);
INIT_LIST_HEAD(&ch->cmd_wait_list);
+1
View File
@@ -285,6 +285,7 @@ struct srpt_rdma_ch {
struct ib_cm_id *cm_id;
struct ib_qp *qp;
int rq_size;
atomic_t processing_compl;
struct ib_cq *cq;
atomic_t sq_wr_avail;
struct srpt_port *sport;