isert: fix a possible extra refcount put of isert connection

On login logout stress we can start a teardown flow before connection is
fully established.
In this case we have one less refcount on isert connection.

Signed-off-by: Israel Rukshin <israelr@mellanox.com>

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6937 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Israel Rukshin
2016-08-17 07:27:15 +00:00
parent a3b45f61bf
commit 32ca0a7846
2 changed files with 7 additions and 1 deletions

View File

@@ -160,6 +160,7 @@ struct isert_cq {
#define ISERT_DRAIN_POSTED 1
#define ISERT_DRAIN_FAILED 2
#define ISERT_DISCON_CALLED 3
#define ISERT_CONNECTION_EST 4
struct isert_connection {
struct iscsi_conn iscsi ____cacheline_aligned;

View File

@@ -599,7 +599,10 @@ static void isert_conn_closed_do_work(struct work_struct *work)
if (!test_and_set_bit(ISERT_DISCON_CALLED, &isert_conn->flags))
isert_connection_closed(&isert_conn->iscsi);
isert_conn_free(isert_conn);
/* if connection established we have another refcount */
if (test_bit(ISERT_CONNECTION_EST, &isert_conn->flags)) {
isert_conn_free(isert_conn);
}
}
static void isert_sched_conn_closed(struct isert_connection *isert_conn)
@@ -1480,6 +1483,8 @@ static int isert_cm_connect_handler(struct rdma_cm_id *cm_id,
goto out;
}
set_bit(ISERT_CONNECTION_EST, &isert_conn->flags);
if (push_saved_pdu) {
pr_info("iser push saved rx pdu\n");
isert_recv_completion_handler(isert_conn->saved_wr);