linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Duncan <lduncan@suse.com>
To: Mike Christie <michael.christie@oracle.com>,
	cleech@redhat.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org,
	james.bottomley@hansenpartnership.com
Cc: lutianxiong@huawei.com, linfeilong@huawei.com,
	liuzhiqiang26@huawei.com, haowenchao@huawei.com
Subject: Re: [PATCH 1/3] libiscsi: fix iscsi_prep_scsi_cmd_pdu error handling
Date: Wed, 16 Dec 2020 09:39:13 -0800	[thread overview]
Message-ID: <302ef288-d35b-d8b4-353b-814fce368fca@suse.com> (raw)
In-Reply-To: <1608069210-5755-2-git-send-email-michael.christie@oracle.com>

On 12/15/20 1:53 PM, Mike Christie wrote:
> If iscsi_prep_scsi_cmd_pdu fails we try to add it back to the
> cmdqueue, but we leave it partially setup. We don't have functions
> that can undo the pdu and init task setup. We only have cleanup_task
> which can cleanup both parts. So this has us just fail the cmd and
> go through the standard cleanup routine and then have scsi-ml retry
> it like is done when it fails in the queuecommand path.
> 
> Signed-off-by: Mike Christie <michael.christie@oracle.com>
> Reviewed-by: Lee Duncan <lduncan@suse.com>
> ---
>  drivers/scsi/libiscsi.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
> index f9314f1..ee0786b 100644
> --- a/drivers/scsi/libiscsi.c
> +++ b/drivers/scsi/libiscsi.c
> @@ -1532,14 +1532,9 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
>  		}
>  		rc = iscsi_prep_scsi_cmd_pdu(conn->task);
>  		if (rc) {
> -			if (rc == -ENOMEM || rc == -EACCES) {
> -				spin_lock_bh(&conn->taskqueuelock);
> -				list_add_tail(&conn->task->running,
> -					      &conn->cmdqueue);
> -				conn->task = NULL;
> -				spin_unlock_bh(&conn->taskqueuelock);
> -				goto done;
> -			} else
> +			if (rc == -ENOMEM || rc == -EACCES)
> +				fail_scsi_task(conn->task, DID_IMM_RETRY);
> +			else
>  				fail_scsi_task(conn->task, DID_ABORT);
>  			spin_lock_bh(&conn->taskqueuelock);
>  			continue;
> 

Reviewed-by: Lee Duncan <lduncan@suse.com>


  reply	other threads:[~2020-12-16 17:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 21:53 [PATCH 0/3] iscsi cmd lifetime fixups/cleanups Mike Christie
2020-12-15 21:53 ` [PATCH 1/3] libiscsi: fix iscsi_prep_scsi_cmd_pdu error handling Mike Christie
2020-12-16 17:39   ` Lee Duncan [this message]
2020-12-15 21:53 ` [PATCH 2/3] libiscsi: drop taskqueuelock Mike Christie
2020-12-15 21:53 ` [PATCH 3/3] libiscsi: fix iscsi_task use after free Mike Christie
2020-12-16  7:38   ` Mike Christie
2020-12-16 18:55 [PATCH 0/3 V2] iscsi cmd lifetime fixups/cleanups Mike Christie
2020-12-16 18:55 ` [PATCH 1/3] libiscsi: fix iscsi_prep_scsi_cmd_pdu error handling Mike Christie

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=302ef288-d35b-d8b4-353b-814fce368fca@suse.com \
    --to=lduncan@suse.com \
    --cc=cleech@redhat.com \
    --cc=haowenchao@huawei.com \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=linfeilong@huawei.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=liuzhiqiang26@huawei.com \
    --cc=lutianxiong@huawei.com \
    --cc=martin.petersen@oracle.com \
    --cc=michael.christie@oracle.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;
as well as URLs for NNTP newsgroup(s).