diff options
author | Sagi Grimberg <sagig@mellanox.com> | 2015-07-16 10:28:05 +0300 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-07-23 22:54:21 -0700 |
commit | 4e4937e8aefde8d49340e803ebbedcdf4b43e5f0 (patch) | |
tree | ea9153817ac32402c68db2eb7b9b48d4a5cbcd6a /drivers/target/target_core_transport.c | |
parent | f5a8b3a796db01b639435515b3adc003b9f27387 (diff) | |
download | op-kernel-dev-4e4937e8aefde8d49340e803ebbedcdf4b43e5f0.zip op-kernel-dev-4e4937e8aefde8d49340e803ebbedcdf4b43e5f0.tar.gz |
target: Return descriptor format sense data in case the LU spans 64bit sectors
In case a LU spans 64bit sectors, fixed size sense data information
field is only 32 bits which means the sector information will be truncated.
Thus, if the LU spans 64bit sectors, use descriptor format sense data to
correctly report sector information.
Reported-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_transport.c')
-rw-r--r-- | drivers/target/target_core_transport.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 7fb031b..98155db 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2735,6 +2735,7 @@ static int translate_sense_reason(struct se_cmd *cmd, sense_reason_t reason) u8 *buffer = cmd->sense_buffer; int r = (__force int)reason; u8 asc, ascq; + bool desc_format = target_sense_desc_format(cmd->se_dev); if (r < ARRAY_SIZE(sense_info_table) && sense_info_table[r].key) si = &sense_info_table[r]; @@ -2754,7 +2755,7 @@ static int translate_sense_reason(struct se_cmd *cmd, sense_reason_t reason) ascq = si->ascq; } - scsi_build_sense_buffer(0, buffer, si->key, asc, ascq); + scsi_build_sense_buffer(desc_format, buffer, si->key, asc, ascq); if (si->add_sector_info) return scsi_set_sense_information(buffer, cmd->scsi_sense_length, |