From 00ad4d0209dcc7858e8c4faebc36513a4a1eaeb8 Mon Sep 17 00:00:00 2001 From: Yan Burman Date: Sun, 7 Sep 2014 13:39:18 +0000 Subject: [PATCH] isert: Cleanup iscsi connection as soon as possible to allow lower session reinstate times Signed-off-by: Yan Burman git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/iser@5781 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/isert-scst/iser.h | 1 + iscsi-scst/kernel/isert-scst/iser_rdma.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/iscsi-scst/kernel/isert-scst/iser.h b/iscsi-scst/kernel/isert-scst/iser.h index 97f947940..e0ba95d6c 100644 --- a/iscsi-scst/kernel/isert-scst/iser.h +++ b/iscsi-scst/kernel/isert-scst/iser.h @@ -105,6 +105,7 @@ struct isert_cq { #define ISERT_CONNECTION_ABORTED 0 #define ISERT_DRAIN_POSTED 1 +#define ISERT_DRAIN_FAILED 2 struct isert_connection { struct iscsi_conn iscsi ____cacheline_aligned; diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index 8ead9081e..cfd9b3648 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -134,6 +134,7 @@ void isert_conn_disconnect(struct isert_connection *isert_conn) pr_err("Failed to post drain wr, err:%d\n", err); /* We need to decrement iser_conn->kref in order to be able to cleanup * the connection */ + set_bit(ISERT_DRAIN_FAILED, &isert_conn->flags); isert_conn_free(isert_conn); } } @@ -500,10 +501,14 @@ static void isert_handle_wc_error(struct ib_wc *wc) switch (wr->wr_op) { case ISER_WR_SEND: - if (unlikely(wr->send_wr.num_sge == 0)) /* Drain WR */ + if (unlikely(wr->send_wr.num_sge == 0)) { /* Drain WR */ + /* notify upper layer */ + if (!test_bit(ISERT_CONNECTION_ABORTED, &isert_conn->flags)) + isert_connection_closed(&isert_conn->iscsi); isert_conn_free(isert_conn); - else + } else { isert_pdu_err(&isert_pdu->iscsi); + } break; case ISER_WR_RDMA_READ: isert_pdu_err(&isert_pdu->iscsi); @@ -1111,7 +1116,7 @@ static void isert_conn_closed_do_work(struct work_struct *work) #endif /* notify upper layer */ - if (!test_bit(ISERT_CONNECTION_ABORTED, &isert_conn->flags)) + if (test_bit(ISERT_DRAIN_FAILED, &isert_conn->flags)) isert_connection_closed(&isert_conn->iscsi); isert_conn_free(isert_conn);