Re: [PATCH 2/4] Target/iser: Fix hangs in connection teardown

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2014-05-19 at 17:44 +0300, Sagi Grimberg wrote:
> In ungraceful teardowns isert close flows seem racy such that
> isert_wait_conn hangs as RDMA_CM_EVENT_DISCONNECTED never
> gets invoked (no one called rdma_disconnect).
> 
> Both graceful and ungraceful teardowns will have rx flush errors
> (isert posts a batch once connection is established). Once all
> flush errors are consumed we invoke isert_wait_conn and it will
> be responsible for calling rdma_disconnect. This way it can be
> sure that rdma_disconnect was called and it won't wait forever.
> 
> This patch also removes the logout_posted indicator. either the
> logout completion was consumed and no problem decrementing the
> post_send_buf_count, or it was consumed as a flush error. no point
> of keeping it for isert_wait_conn as there is no danger that
> isert_conn will be accidentally removed while it is running.
> 
> Signed-off-by: Sagi Grimberg <sagig@xxxxxxxxxxxx>
> ---
>  drivers/infiniband/ulp/isert/ib_isert.c |   32 ++++++++++--------------------
>  drivers/infiniband/ulp/isert/ib_isert.h |    1 -
>  2 files changed, 11 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
> index aed4866..6f0bb80 100644
> --- a/drivers/infiniband/ulp/isert/ib_isert.c
> +++ b/drivers/infiniband/ulp/isert/ib_isert.c
> @@ -787,14 +787,10 @@ isert_disconnect_work(struct work_struct *work)
>  		isert_put_conn(isert_conn);
>  		return;
>  	}
> -	if (!isert_conn->logout_posted) {
> -		pr_debug("Calling rdma_disconnect for !logout_posted from"
> -			 " isert_disconnect_work\n");
> -		rdma_disconnect(isert_conn->conn_cm_id);
> -		mutex_unlock(&isert_conn->conn_mutex);
> -		iscsit_cause_connection_reinstatement(isert_conn->conn, 0);
> -		goto wake_up;
> -	}
> +
> +	/* Send DREQ/DREP towards our initiator */
> +	rdma_disconnect(isert_conn->conn_cm_id);
> +
>  	mutex_unlock(&isert_conn->conn_mutex);
>  
>  wake_up:
> @@ -1822,11 +1818,8 @@ isert_do_control_comp(struct work_struct *work)
>  		break;
>  	case ISTATE_SEND_LOGOUTRSP:
>  		pr_debug("Calling iscsit_logout_post_handler >>>>>>>>>>>>>>\n");
> -		/*
> -		 * Call atomic_dec(&isert_conn->post_send_buf_count)
> -		 * from isert_wait_conn()
> -		 */
> -		isert_conn->logout_posted = true;
> +
> +		atomic_dec(&isert_conn->post_send_buf_count);
>  		iscsit_logout_post_handler(cmd, cmd->conn);
>  		break;
>  	case ISTATE_SEND_TEXTRSP:
> @@ -2032,6 +2025,9 @@ isert_cq_rx_comp_err(struct isert_conn *isert_conn)
>  	isert_conn->state = ISER_CONN_DOWN;
>  	mutex_unlock(&isert_conn->conn_mutex);
>  
> +	if (!atomic_read(&conn->sleep_on_conn_wait_comp))
> +		iscsit_cause_connection_reinstatement(isert_conn->conn, 0);
> +

No need to check sleep_on_conn_wait_comp here, the call is already
checking ->connection_reinstatement to only invoke the connection
reinstatement logic once..

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux