diff mbox

scsi: Fix sense information setting in fixed sized format

Message ID 1436367603-16456-1-git-send-email-sagig@mellanox.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sagi Grimberg July 8, 2015, 3 p.m. UTC
In fixed size sense format the information field is a four byte
field.

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
---
 drivers/scsi/scsi_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bart Van Assche July 9, 2015, 2:38 p.m. UTC | #1
On 07/08/15 08:00, Sagi Grimberg wrote:
> In fixed size sense format the information field is a four byte
> field.
>
> Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
> ---
>   drivers/scsi/scsi_common.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/scsi_common.c b/drivers/scsi/scsi_common.c
> index 41432c1..8cfb7ee 100644
> --- a/drivers/scsi/scsi_common.c
> +++ b/drivers/scsi/scsi_common.c
> @@ -270,7 +270,7 @@ void scsi_set_sense_information(u8 *buf, u64 info)
>   		put_unaligned_be64(info, &ucp[4]);
>   	} else if ((buf[0] & 0x7f) == 0x70) {
>   		buf[0] |= 0x80;
> -		put_unaligned_be64(info, &buf[3]);
> +		put_unaligned_be32(info, &buf[3]);
>   	}
>   }
>   EXPORT_SYMBOL(scsi_set_sense_information);

Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Martin K. Petersen July 9, 2015, 4:27 p.m. UTC | #2
>>>>> "Sagi" == Sagi Grimberg <sagig@mellanox.com> writes:

Sagi> In fixed size sense format the information field is a four byte
Sagi> field.

Correct.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Christoph Hellwig July 11, 2015, 11:27 a.m. UTC | #3
On Wed, Jul 08, 2015 at 06:00:03PM +0300, Sagi Grimberg wrote:
> In fixed size sense format the information field is a four byte
> field.

This looks correct to me,

Reviewed-by: Christoph Hellwig <hch@lst.de>

But: this will truncate > 32bit sector numbers.  Maybe we need to
enable descriptor format sense data for large enough LUs.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sagi Grimberg July 12, 2015, 6:36 a.m. UTC | #4
> This looks correct to me,
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
>
> But: this will truncate > 32bit sector numbers.  Maybe we need to
> enable descriptor format sense data for large enough LUs.

That should be easy enough now that the sense data is constructed using
scsi helpers.

Let me prepare a patch for that.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/scsi/scsi_common.c b/drivers/scsi/scsi_common.c
index 41432c1..8cfb7ee 100644
--- a/drivers/scsi/scsi_common.c
+++ b/drivers/scsi/scsi_common.c
@@ -270,7 +270,7 @@  void scsi_set_sense_information(u8 *buf, u64 info)
 		put_unaligned_be64(info, &ucp[4]);
 	} else if ((buf[0] & 0x7f) == 0x70) {
 		buf[0] |= 0x80;
-		put_unaligned_be64(info, &buf[3]);
+		put_unaligned_be32(info, &buf[3]);
 	}
 }
 EXPORT_SYMBOL(scsi_set_sense_information);