public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Leech <cleech@redhat.com>
To: Mike Christie <michael.christie@oracle.com>
Cc: skashyap@marvell.com, lduncan@suse.com, njavali@marvell.com,
	mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com,
	martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
	jejb@linux.ibm.com
Subject: Re: [PATCH 09/10] scsi: qedi: Fix failed disconnect handling.
Date: Fri, 8 Apr 2022 19:00:57 -0700	[thread overview]
Message-ID: <YlDo2f70SeNp2Kng@localhost> (raw)
In-Reply-To: <20220408001314.5014-10-michael.christie@oracle.com>

On Thu, Apr 07, 2022 at 07:13:13PM -0500, Mike Christie wrote:
> We set the qedi_ep state to EP_STATE_OFLDCONN_START when the ep is
> created. Then in qedi_set_path we kick off the offload work. If userspace
> times out the connection and calls ep_disconnect, qedi will only flush the
> offload work if the qedi_ep state has transitioned away from
> EP_STATE_OFLDCONN_START. If we can't connect we will not have transitioned
> state and will leave the offload work running, and we will free the
> qedi_ep from under it.
> 
> This patch just has us init the work when we create the ep, then always
> flush it.
> 
> Signed-off-by: Mike Christie <michael.christie@oracle.com>
> ---
>  drivers/scsi/qedi/qedi_iscsi.c | 69 +++++++++++++++++-----------------
>  1 file changed, 34 insertions(+), 35 deletions(-)

Reviewed-by: Chris Leech <cleech@redhat.com>
 
> diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c
> index 8196f89f404e..31ec429104e2 100644
> --- a/drivers/scsi/qedi/qedi_iscsi.c
> +++ b/drivers/scsi/qedi/qedi_iscsi.c
> @@ -860,6 +860,37 @@ static int qedi_task_xmit(struct iscsi_task *task)
>  	return qedi_iscsi_send_ioreq(task);
>  }
>  
> +static void qedi_offload_work(struct work_struct *work)
> +{
> +	struct qedi_endpoint *qedi_ep =
> +		container_of(work, struct qedi_endpoint, offload_work);
> +	struct qedi_ctx *qedi;
> +	int wait_delay = 5 * HZ;
> +	int ret;
> +
> +	qedi = qedi_ep->qedi;
> +
> +	ret = qedi_iscsi_offload_conn(qedi_ep);
> +	if (ret) {
> +		QEDI_ERR(&qedi->dbg_ctx,
> +			 "offload error: iscsi_cid=%u, qedi_ep=%p, ret=%d\n",
> +			 qedi_ep->iscsi_cid, qedi_ep, ret);
> +		qedi_ep->state = EP_STATE_OFLDCONN_FAILED;
> +		return;
> +	}
> +
> +	ret = wait_event_interruptible_timeout(qedi_ep->tcp_ofld_wait,
> +					       (qedi_ep->state ==
> +					       EP_STATE_OFLDCONN_COMPL),
> +					       wait_delay);
> +	if (ret <= 0 || qedi_ep->state != EP_STATE_OFLDCONN_COMPL) {
> +		qedi_ep->state = EP_STATE_OFLDCONN_FAILED;
> +		QEDI_ERR(&qedi->dbg_ctx,
> +			 "Offload conn TIMEOUT iscsi_cid=%u, qedi_ep=%p\n",
> +			 qedi_ep->iscsi_cid, qedi_ep);
> +	}
> +}
> +
>  static struct iscsi_endpoint *
>  qedi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
>  		int non_blocking)
> @@ -908,6 +939,7 @@ qedi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
>  	}
>  	qedi_ep = ep->dd_data;
>  	memset(qedi_ep, 0, sizeof(struct qedi_endpoint));
> +	INIT_WORK(&qedi_ep->offload_work, qedi_offload_work);
>  	qedi_ep->state = EP_STATE_IDLE;
>  	qedi_ep->iscsi_cid = (u32)-1;
>  	qedi_ep->qedi = qedi;
> @@ -1056,12 +1088,11 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep)
>  	qedi_ep = ep->dd_data;
>  	qedi = qedi_ep->qedi;
>  
> +	flush_work(&qedi_ep->offload_work);
> +
>  	if (qedi_ep->state == EP_STATE_OFLDCONN_START)
>  		goto ep_exit_recover;
>  
> -	if (qedi_ep->state != EP_STATE_OFLDCONN_NONE)
> -		flush_work(&qedi_ep->offload_work);
> -
>  	if (qedi_ep->conn) {
>  		qedi_conn = qedi_ep->conn;
>  		abrt_conn = qedi_conn->abrt_conn;
> @@ -1235,37 +1266,6 @@ static int qedi_data_avail(struct qedi_ctx *qedi, u16 vlanid)
>  	return rc;
>  }
>  
> -static void qedi_offload_work(struct work_struct *work)
> -{
> -	struct qedi_endpoint *qedi_ep =
> -		container_of(work, struct qedi_endpoint, offload_work);
> -	struct qedi_ctx *qedi;
> -	int wait_delay = 5 * HZ;
> -	int ret;
> -
> -	qedi = qedi_ep->qedi;
> -
> -	ret = qedi_iscsi_offload_conn(qedi_ep);
> -	if (ret) {
> -		QEDI_ERR(&qedi->dbg_ctx,
> -			 "offload error: iscsi_cid=%u, qedi_ep=%p, ret=%d\n",
> -			 qedi_ep->iscsi_cid, qedi_ep, ret);
> -		qedi_ep->state = EP_STATE_OFLDCONN_FAILED;
> -		return;
> -	}
> -
> -	ret = wait_event_interruptible_timeout(qedi_ep->tcp_ofld_wait,
> -					       (qedi_ep->state ==
> -					       EP_STATE_OFLDCONN_COMPL),
> -					       wait_delay);
> -	if ((ret <= 0) || (qedi_ep->state != EP_STATE_OFLDCONN_COMPL)) {
> -		qedi_ep->state = EP_STATE_OFLDCONN_FAILED;
> -		QEDI_ERR(&qedi->dbg_ctx,
> -			 "Offload conn TIMEOUT iscsi_cid=%u, qedi_ep=%p\n",
> -			 qedi_ep->iscsi_cid, qedi_ep);
> -	}
> -}
> -
>  static int qedi_set_path(struct Scsi_Host *shost, struct iscsi_path *path_data)
>  {
>  	struct qedi_ctx *qedi;
> @@ -1381,7 +1381,6 @@ static int qedi_set_path(struct Scsi_Host *shost, struct iscsi_path *path_data)
>  			  qedi_ep->dst_addr, qedi_ep->dst_port);
>  	}
>  
> -	INIT_WORK(&qedi_ep->offload_work, qedi_offload_work);
>  	queue_work(qedi->offload_thread, &qedi_ep->offload_work);
>  
>  	ret = 0;
> -- 
> 2.25.1
> 


  parent reply	other threads:[~2022-04-09  2:01 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-08  0:13 [PATCH 00/10] iscsi fixes Mike Christie
2022-04-08  0:13 ` [PATCH 01/10] scsi: iscsi: Move iscsi_ep_disconnect Mike Christie
2022-04-09  1:36   ` Chris Leech
2022-04-08  0:13 ` [PATCH 02/10] scsi: iscsi: Fix offload conn cleanup when iscsid restarts Mike Christie
2022-04-08 17:21   ` Lee Duncan
2022-04-09  1:36   ` Chris Leech
2022-04-08  0:13 ` [PATCH 03/10] scsi: iscsi: Release endpoint ID when its freed Mike Christie
2022-04-08 17:39   ` Lee Duncan
2022-04-09  1:40   ` Chris Leech
2022-04-11  7:22   ` wubo (T)
2022-04-08  0:13 ` [PATCH 04/10] scsi: iscsi: Fix endpoint reuse regression Mike Christie
2022-04-08 17:40   ` Lee Duncan
2022-04-09  1:41   ` Chris Leech
2022-04-08  0:13 ` [PATCH 05/10] scsi: iscsi: Fix conn cleanup and stop race during iscsid restart Mike Christie
2022-04-08 17:48   ` Lee Duncan
2022-04-09  1:46   ` Chris Leech
2022-04-08  0:13 ` [PATCH 06/10] scsi: iscsi: Fix unbound endpoint error handling Mike Christie
2022-04-08 17:55   ` Lee Duncan
2022-04-09  1:54   ` Chris Leech
2022-04-08  0:13 ` [PATCH 07/10] scsi: iscsi: Merge suspend fields Mike Christie
2022-04-09  1:56   ` Chris Leech
2022-04-08  0:13 ` [PATCH 08/10] scsi: iscsi: Fix nop handling during conn recovery Mike Christie
2022-04-09  1:59   ` Chris Leech
2022-04-08  0:13 ` [PATCH 09/10] scsi: qedi: Fix failed disconnect handling Mike Christie
2022-04-08 16:49   ` [EXT] " Manish Rangankar
2022-04-08 17:58   ` Lee Duncan
2022-04-09  2:00   ` Chris Leech [this message]
2022-04-08  0:13 ` [PATCH 10/10] scsi: iscsi: Add Mike Christie as co-maintainer Mike Christie
2022-04-08 17:59   ` Lee Duncan
2022-04-09  1:57   ` Chris Leech
2022-04-08 16:47 ` [EXT] [PATCH 00/10] iscsi fixes Manish Rangankar
2022-04-12  2:36 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YlDo2f70SeNp2Kng@localhost \
    --to=cleech@redhat.com \
    --cc=GR-QLogic-Storage-Upstream@marvell.com \
    --cc=jejb@linux.ibm.com \
    --cc=lduncan@suse.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michael.christie@oracle.com \
    --cc=mrangankar@marvell.com \
    --cc=njavali@marvell.com \
    --cc=skashyap@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox