public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Sagi Grimberg <sagig@dev.mellanox.co.il>
To: Mike Christie <michaelc@cs.wisc.edu>, Sagi Grimberg <sagig@mellanox.com>
Cc: roland@kernel.org, nab@linux-iscsi.org, oren@mellanox.com,
	martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
	linux-rdma@vger.kernel.org
Subject: Re: [PATCH v1 11/13] SCSI/libiscsi: Add check_protection callback for transports
Date: Mon, 03 Mar 2014 10:08:54 +0200	[thread overview]
Message-ID: <53143896.6080105@dev.mellanox.co.il> (raw)
In-Reply-To: <531407FF.1040702@cs.wisc.edu>

On 3/3/2014 6:41 AM, Mike Christie wrote:
> On 02/27/2014 05:13 AM, Sagi Grimberg wrote:
>> diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
>> index 4046241..a58a6bb 100644
>> --- a/drivers/scsi/libiscsi.c
>> +++ b/drivers/scsi/libiscsi.c
>> @@ -395,6 +395,10 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
>>   		if (rc)
>>   			return rc;
>>   	}
>> +
>> +	if (scsi_get_prot_op(sc) != SCSI_PROT_NORMAL)
>> +		task->protected = true;
>> +
>>   	if (sc->sc_data_direction == DMA_TO_DEVICE) {
>>   		unsigned out_len = scsi_out(sc)->length;
>>   		struct iscsi_r2t_info *r2t = &task->unsol_r2t;
>> @@ -823,6 +827,33 @@ static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
>>   
>>   	sc->result = (DID_OK << 16) | rhdr->cmd_status;
>>   
>> +	if (task->protected) {
>> +		sector_t sector;
>> +		u8 ascq;
>> +
>> +		/**
>> +		 * Transports that didn't implement check_protection
>> +		 * callback but still published T10-PI support to scsi-mid
>> +		 * deserve this BUG_ON.
>> +		 **/
>> +		 BUG_ON(!session->tt->check_protection);
> Extra space before BUG_ON.

I'll add.

>> +
>> +		ascq = session->tt->check_protection(task, &sector);
>> +		if (ascq) {
>> +			sc->result = DRIVER_SENSE << 24 | DID_ABORT << 16 |
>> +				     SAM_STAT_CHECK_CONDITION;
> I am not sure what the reason for the DID_ABORT is here. I do not think
> we want that, because we just want scsi-ml to evaluate the sense error
> part of the failure. It works ok today, but the DID_ABORT error can
> possibly be evaluated before the sense so you might miss passing that
> info to upper layers.

That makes sense to me. I can remove DID_ABORT.

>
>> +			scsi_build_sense_buffer(1, sc->sense_buffer,
>> +						ILLEGAL_REQUEST, 0x10, ascq);
>> +			sc->sense_buffer[7] = 0xc; /* Additional sense length */
>> +			sc->sense_buffer[8] = 0;   /* Information desc type */
>> +			sc->sense_buffer[9] = 0xa; /* Additional desc length */
>> +			sc->sense_buffer[10] = 0x80; /* Validity bit */
>> +
>> +			put_unaligned_be64(sector, &sc->sense_buffer[12]);
>> +			goto out;
>> +		}
>> +	}
>> +
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


  reply	other threads:[~2014-03-03  8:08 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
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
     [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 [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=53143896.6080105@dev.mellanox.co.il \
    --to=sagig@dev.mellanox.co.il \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michaelc@cs.wisc.edu \
    --cc=nab@linux-iscsi.org \
    --cc=oren@mellanox.com \
    --cc=roland@kernel.org \
    --cc=sagig@mellanox.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