linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Christie <michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
To: Sagi Grimberg <sagig-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Cc: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	nab-IzHhD5pYlfBP7FQvKIMDCQ@public.gmane.org,
	oren-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
	martin.petersen-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v1 10/13] IB/iser: Support T10-PI operations
Date: Wed, 05 Mar 2014 11:55:26 -0600	[thread overview]
Message-ID: <5317650E.40306@cs.wisc.edu> (raw)
In-Reply-To: <5315A3E4.508-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>

On 03/04/2014 03:59 AM, Sagi Grimberg wrote:
> On 3/4/2014 11:38 AM, Or Gerlitz wrote:
>> On 03/03/2014 06:44, Mike Christie wrote:
>>> The xmit_task callout does handle failures like EINVAL. If the above map
>>> calls fail then you would get infinite retries. You would currently want
>>> to do the mapping in the init_task callout instead.
>>>
>>> If it makes it easier on the driver implementation then it is ok to
>>> modify the xmit_task callers so that they handle multiple error codes
>>> for drivers like iser that have the xmit_task callout called from
>>> iscsi_queuecommand.
>>
>> Mike,
>>
>> After looking on the code with Sagi,  it seems to us that the correct
>> way to go here, would be to enhance in iscsi_queuecommand the
>> processing of the result returned by session->tt->xmit_task(task) to
>> behave in a similar manner to how the return value of
>> iscsi_prep_scsi_cmd_pdu() is treated. E.g for errors such as ENOMEM
>> and EGAIN take the "reject" flow which would cause the SCSI midlayer
>> to retry the command and for other return values go to the "fault"
>> flow which will cause the ML to abort the command.
>>
>> Or.
>>
> 
> Yes, we were thinking about the following:
> --- a/drivers/scsi/libiscsi.c
> +++ b/drivers/scsi/libiscsi.c
> @@ -1707,10 +1707,17 @@ int iscsi_queuecommand(struct Scsi_Host *host,
> struct scsi_cmnd *sc)
>                                 goto prepd_fault;
>                         }
>                 }
> -               if (session->tt->xmit_task(task)) {
> -                       session->cmdsn--;
> -                       reason = FAILURE_SESSION_NOT_READY;
> -                       goto prepd_reject;
> +
> +               reason = session->tt->xmit_task(task);
> +               if (reason) {
> +                       if (reason == -ENOMEM || reason == -EAGAIN) {
> +                               session->cmdsn--;
> +                               reason = FAILURE_SESSION_NOT_READY;
> +                               goto prepd_reject;
> +                       } else {
> +                               sc->result = DID_ABORT << 16;
> +                               goto prepd_fault;
> +                       }

Or is correct.

If iscsi_prep_scsi_cmd_pdu is successful then it will increment cmdsn.

In this code path for xmit_task above, we assume that the driver can
either take the entire command and can send it here, or return error and
we requeue. For your new error case where we cannot send the command due
to a hard failure so we want to fail the command, then we still need to
decrement the cmdsn or there would be a hole since it was never put on
the wire.

Also, it is probably safest to check for the error code you are adding
support for:

reason = session->tt->xmit_task(task);
if (reason) {
	session->cmdsn--;

	if (reason == -EINVAL) {
		sc->result = DID_ABORT << 16;
		goto prepd_fault;
	} else {
		sc->result = DID_ABORT << 16;
		goto prepd_fault;
	}
}
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-03-05 17:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-27 11:12 [PATCH v1 00/13] T10-PI support for iSER initiator Sagi Grimberg
2014-02-27 11:12 ` [PATCH v1 02/13] IB/iser: Push the desicion what memory key to use into fast_reg_mr routine Sagi Grimberg
2014-02-27 11:12 ` [PATCH v1 03/13] IB/iser: Move fast_reg_descriptor initialization to a function Sagi Grimberg
2014-02-27 11:13 ` [PATCH v1 04/13] IB/iser: Keep IB device attributes under iser_device Sagi Grimberg
2014-02-27 11:13 ` [PATCH v1 05/13] IB/iser: Replace fastreg descriptor valid bool with indicators container Sagi Grimberg
     [not found] ` <1393499589-15633-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2014-02-27 11:12   ` [PATCH v1 01/13] IB/iser: Avoid FRWR notation, use fastreg instead Sagi Grimberg
2014-02-27 11:13   ` [PATCH v1 06/13] IB/iser: Generalize iser_unmap_task_data and finalize_rdma_unaligned_sg Sagi Grimberg
2014-02-27 11:13   ` [PATCH v1 07/13] IB/iser: Generalize fall_to_bounce_buf routine Sagi Grimberg
2014-02-27 11:13   ` [PATCH v1 08/13] IB/iser: Introduce pi_enable, pi_guard module parameters Sagi Grimberg
2014-02-27 11:13   ` [PATCH v1 11/13] SCSI/libiscsi: Add check_protection callback for transports Sagi Grimberg
     [not found]     ` <1393499589-15633-12-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2014-03-03  4:41       ` Mike Christie
2014-03-03  8:08         ` Sagi Grimberg
2014-02-27 11:13 ` [PATCH v1 09/13] IB/iser: Initialize T10-PI resources Sagi Grimberg
2014-02-27 11:13 ` [PATCH v1 10/13] IB/iser: Support T10-PI operations Sagi Grimberg
2014-03-03  4:44   ` Mike Christie
2014-03-03  8:23     ` Sagi Grimberg
     [not found]     ` <531408C8.10107-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
2014-03-04  9:38       ` Or Gerlitz
     [not found]         ` <53159F09.6050802-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2014-03-04  9:59           ` Sagi Grimberg
     [not found]             ` <5315A3E4.508-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2014-03-04 11:25               ` Or Gerlitz
2014-03-04 14:44                 ` Sagi Grimberg
     [not found]                   ` <5315E6DD.4060909-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2014-03-04 16:16                     ` Or Gerlitz
2014-03-04 17:04                       ` Sagi Grimberg
2014-03-05 17:55               ` Mike Christie [this message]
2014-02-27 11:13 ` [PATCH v1 12/13] IB/iser: Implement check_protection Sagi Grimberg
2014-02-27 11:13 ` [PATCH v1 13/13] IB/iser: Publish T10-PI support to SCSI midlayer Sagi Grimberg

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=5317650E.40306@cs.wisc.edu \
    --to=michaelc-hcno3ddehluvc3sceru5cw@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=martin.petersen-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=nab-IzHhD5pYlfBP7FQvKIMDCQ@public.gmane.org \
    --cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=oren-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sagig-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    --cc=sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    /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).