Merge r5792 from 3.0.x-iser branch

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.0.x@6244 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2015-06-11 15:42:55 +00:00
parent 6fe3cb0eba
commit 8b5061f5f8
3 changed files with 34 additions and 10 deletions
+1
View File
@@ -161,6 +161,7 @@ struct isert_connection {
unsigned long flags;
struct work_struct close_work;
struct work_struct drain_work;
struct isert_wr drain_wr;
struct kref kref;
+31 -8
View File
@@ -486,6 +486,36 @@ static const char *wr_status_str(enum ib_wc_status status)
}
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
static void isert_conn_drained_do_work(void *ctx)
#else
static void isert_conn_drained_do_work(struct work_struct *work)
#endif
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
struct isert_connection *isert_conn = ctx;
#else
struct isert_connection *isert_conn =
container_of(work, struct isert_connection, drain_work);
#endif
/* notify upper layer */
if (!test_bit(ISERT_CONNECTION_ABORTED, &isert_conn->flags))
isert_connection_closed(&isert_conn->iscsi);
isert_conn_free(isert_conn);
}
static void isert_sched_conn_drained(struct isert_connection *isert_conn)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
INIT_WORK(&isert_conn->drain_work, isert_conn_drained_do_work, isert_conn);
#else
INIT_WORK(&isert_conn->drain_work, isert_conn_drained_do_work);
#endif
isert_conn_queue_work(&isert_conn->drain_work);
}
static void isert_handle_wc_error(struct ib_wc *wc)
{
struct isert_wr *wr = _u64_to_ptr(wc->wr_id);
@@ -502,10 +532,7 @@ 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 */
/* notify upper layer */
if (!test_bit(ISERT_CONNECTION_ABORTED, &isert_conn->flags))
isert_connection_closed(&isert_conn->iscsi);
isert_conn_free(isert_conn);
isert_sched_conn_drained(isert_conn);
} else {
isert_pdu_err(&isert_pdu->iscsi);
}
@@ -1063,8 +1090,6 @@ fail_get:
return ERR_PTR(err);
}
/* start closing process;
* only when all buffers released, can free */
static void isert_kref_free(struct kref *kref)
{
struct isert_connection *isert_conn = container_of(kref,
@@ -1077,8 +1102,6 @@ static void isert_kref_free(struct kref *kref)
pr_info("isert_conn_free conn:%p\n", isert_conn);
flush_workqueue(isert_conn->cq_desc->cq_workqueue);
isert_free_conn_resources(isert_conn);
isert_conn_qp_destroy(isert_conn);
+2 -2
View File
@@ -269,7 +269,7 @@ static int isert_conn_activate(struct iscsi_conn *conn)
return 0;
}
static void isert_conn_free(struct iscsi_conn *conn)
static void isert_free_conn(struct iscsi_conn *conn)
{
isert_free_connection(conn);
}
@@ -452,7 +452,7 @@ static struct iscsit_transport isert_transport = {
.transport_type = ISCSI_RDMA,
.iscsit_conn_alloc = isert_conn_alloc,
.iscsit_conn_activate = isert_conn_activate,
.iscsit_conn_free = isert_conn_free,
.iscsit_conn_free = isert_free_conn,
.iscsit_alloc_cmd = isert_cmnd_alloc,
.iscsit_free_cmd = isert_cmnd_free,
.iscsit_preprocessing_done = isert_preprocessing_done,