mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 02:31:27 +00:00
isert: fix isert conn refcount release at unreachable event
On unreachable event the isert conn kref is always 2. The refcount becomes 2 after successful connect event. Signed-off-by: Israel Rukshin <israelr@mellanox.com> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6941 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -217,6 +217,7 @@ struct isert_connection {
|
||||
struct work_struct close_work;
|
||||
struct work_struct drain_work;
|
||||
struct work_struct discon_work;
|
||||
struct work_struct free_work;
|
||||
struct isert_wr drain_wr;
|
||||
struct kref kref;
|
||||
|
||||
@@ -288,6 +289,7 @@ void isert_free_conn_resources(struct isert_connection *isert_conn);
|
||||
void isert_conn_free(struct isert_connection *isert_conn);
|
||||
void isert_conn_disconnect(struct isert_connection *isert_conn);
|
||||
void isert_post_drain(struct isert_connection *isert_conn);
|
||||
void isert_sched_conn_free(struct isert_connection *isert_conn);
|
||||
|
||||
static inline struct isert_connection *isert_conn_zalloc(void)
|
||||
{
|
||||
|
||||
@@ -616,6 +616,32 @@ static void isert_sched_conn_closed(struct isert_connection *isert_conn)
|
||||
isert_conn_queue_work(&isert_conn->close_work);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
static void isert_conn_free_do_work(void *ctx)
|
||||
#else
|
||||
static void isert_conn_free_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, free_work);
|
||||
#endif
|
||||
|
||||
isert_conn_free(isert_conn);
|
||||
}
|
||||
|
||||
void isert_sched_conn_free(struct isert_connection *isert_conn)
|
||||
{
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||
INIT_WORK(&isert_conn->free_work, isert_conn_free_do_work,
|
||||
isert_conn);
|
||||
#else
|
||||
INIT_WORK(&isert_conn->free_work, isert_conn_free_do_work);
|
||||
#endif
|
||||
isert_conn_queue_work(&isert_conn->free_work);
|
||||
}
|
||||
|
||||
static void isert_handle_wc_error(struct ib_wc *wc)
|
||||
{
|
||||
@@ -1645,10 +1671,10 @@ static int isert_cm_evt_handler(struct rdma_cm_id *cm_id,
|
||||
/*
|
||||
* reaching here must be with the isert_conn refcount of 2,
|
||||
* one from the init and one from the connect request,
|
||||
* thus it is safe to deref directly before the sched_conn_closed
|
||||
* thus it is safe to deref directly before the sched_conn_free.
|
||||
*/
|
||||
isert_conn_free(isert_conn);
|
||||
isert_sched_conn_closed(isert_conn);
|
||||
isert_sched_conn_free(isert_conn);
|
||||
err = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user