ib_srpt: Make sure that a DREP is sent to the initiator if a DREQ is received while a session is being closed

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4313 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2012-05-23 07:32:02 +00:00
parent 42d320f400
commit 907bc8222d
2 changed files with 15 additions and 18 deletions

View File

@@ -2076,6 +2076,14 @@ static int srpt_compl_thread(void *arg)
list_del(&ch->list);
spin_unlock_irq(&sdev->spinlock);
if (ch->dreq_received) {
if (ib_send_cm_drep(ch->cm_id, NULL, 0) >= 0)
PRINT_INFO("Received DREQ and sent DREP for session %s",
ch->sess_name);
else
PRINT_ERROR("Sending DREP failed");
}
/*
* If the connection is still established, ib_destroy_cm_id() will
* send a DREQ.
@@ -2728,23 +2736,10 @@ static void srpt_cm_rep_error(struct ib_cm_id *cm_id)
*/
static void srpt_cm_dreq_recv(struct ib_cm_id *cm_id)
{
struct srpt_rdma_ch *ch;
struct srpt_rdma_ch *ch = cm_id->context;
ch = cm_id->context;
switch (srpt_set_ch_state_to_disc(ch)) {
case CH_CONNECTING:
case CH_LIVE:
if (ib_send_cm_drep(ch->cm_id, NULL, 0) >= 0)
PRINT_INFO("Received DREQ and sent DREP for session %s",
ch->sess_name);
else
PRINT_ERROR("Sending DREP failed");
break;
default:
WARN_ON(true);
break;
}
ch->dreq_received = true;
srpt_set_ch_state_to_disc(ch);
}
/**

View File

@@ -306,8 +306,9 @@ enum rdma_ch_state {
* @ioctx_ring: Send I/O context ring.
* @wc: Work completion array.
* @state: channel state. See also enum rdma_ch_state.
* @rtu_received: Whether IB CM RTU event has been received and the requests
* received before that event have been processed.
* @dreq_received: Whether an IB CM DREQ event has been received.
* @rtu_received: Whether an IB CM RTU event has been received and the
* requests received before that event have been processed.
* @list: node for insertion in the srpt_device.rch_list list.
* @cmd_wait_list: list of SCST commands that arrived before the RTU event. This
* list contains struct srpt_ioctx elements and is protected
@@ -340,6 +341,7 @@ struct srpt_rdma_ch {
struct list_head list;
struct list_head cmd_wait_list;
bool rtu_received;
bool dreq_received;
bool last_wqe_received;
struct scst_session *scst_sess;