PI errors should be reported in a descriptor format sense data. Fix that by adding a desc_format flag to struct sense_info and pass it to scsi_build_sense_buffer() to do the right thing. Signed-off-by: Sagi Grimberg <sagig@xxxxxxxxxxxx> --- drivers/target/target_core_transport.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 0181f8b..79bb8d1 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2625,6 +2625,7 @@ struct sense_info { u8 asc; u8 ascq; bool add_sector_info; + int desc_format; }; static const struct sense_info sense_info_table[] = { @@ -2708,18 +2709,21 @@ static const struct sense_info sense_info_table[] = { .asc = 0x10, .ascq = 0x01, /* LOGICAL BLOCK GUARD CHECK FAILED */ .add_sector_info = true, + .desc_format = 1, }, [TCM_LOGICAL_BLOCK_APP_TAG_CHECK_FAILED] = { .key = ILLEGAL_REQUEST, .asc = 0x10, .ascq = 0x02, /* LOGICAL BLOCK APPLICATION TAG CHECK FAILED */ .add_sector_info = true, + .desc_format = 1, }, [TCM_LOGICAL_BLOCK_REF_TAG_CHECK_FAILED] = { .key = ILLEGAL_REQUEST, .asc = 0x10, .ascq = 0x03, /* LOGICAL BLOCK REFERENCE TAG CHECK FAILED */ .add_sector_info = true, + .desc_format = 1, }, [TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE] = { /* @@ -2758,7 +2762,7 @@ static void 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(si->desc_format, buffer, si->key, asc, ascq); if (si->add_sector_info) scsi_set_sense_information(buffer, cmd->bad_sector); } -- 1.8.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html