scsi: target: Rename cmd.bad_sector to cmd.sense_info
[ Upstream commit 8dd992fb67f33a0777fb4bee1e22a5ee5530f024 ]
cmd.bad_sector currently gets packed into the sense INFORMATION field for
TCM_LOGICAL_BLOCK_{GUARD,APP_TAG,REF_TAG}_CHECK_FAILED errors, which carry
an .add_sector_info flag in the sense_detail_table to ensure this.
In preparation for propagating a byte offset on COMPARE AND WRITE
TCM_MISCOMPARE_VERIFY error, rename cmd.bad_sector to cmd.sense_info and
sense_detail.add_sector_info to sense_detail.add_sense_info so that it
better reflects the sense INFORMATION field destination.
[ddiss: update previously overlooked ib_isert]
Link: https://lore.kernel.org/r/20201031233211.5207-3-ddiss@suse.de
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stable-dep-of: 673db054d7a2 ("scsi: target: Fix multiple LUN_RESET handling")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
621c89a021
commit
7c8a29f1b2
@@ -1553,12 +1553,12 @@ isert_check_pi_status(struct se_cmd *se_cmd, struct ib_mr *sig_mr)
|
|||||||
}
|
}
|
||||||
sec_offset_err = mr_status.sig_err.sig_err_offset;
|
sec_offset_err = mr_status.sig_err.sig_err_offset;
|
||||||
do_div(sec_offset_err, block_size);
|
do_div(sec_offset_err, block_size);
|
||||||
se_cmd->bad_sector = sec_offset_err + se_cmd->t_task_lba;
|
se_cmd->sense_info = sec_offset_err + se_cmd->t_task_lba;
|
||||||
|
|
||||||
isert_err("PI error found type %d at sector 0x%llx "
|
isert_err("PI error found type %d at sector 0x%llx "
|
||||||
"expected 0x%x vs actual 0x%x\n",
|
"expected 0x%x vs actual 0x%x\n",
|
||||||
mr_status.sig_err.err_type,
|
mr_status.sig_err.err_type,
|
||||||
(unsigned long long)se_cmd->bad_sector,
|
(unsigned long long)se_cmd->sense_info,
|
||||||
mr_status.sig_err.expected,
|
mr_status.sig_err.expected,
|
||||||
mr_status.sig_err.actual);
|
mr_status.sig_err.actual);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
|||||||
@@ -1438,7 +1438,7 @@ sbc_dif_verify(struct se_cmd *cmd, sector_t start, unsigned int sectors,
|
|||||||
if (rc) {
|
if (rc) {
|
||||||
kunmap_atomic(daddr - dsg->offset);
|
kunmap_atomic(daddr - dsg->offset);
|
||||||
kunmap_atomic(paddr - psg->offset);
|
kunmap_atomic(paddr - psg->offset);
|
||||||
cmd->bad_sector = sector;
|
cmd->sense_info = sector;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
next:
|
next:
|
||||||
|
|||||||
@@ -3135,7 +3135,7 @@ struct sense_detail {
|
|||||||
u8 key;
|
u8 key;
|
||||||
u8 asc;
|
u8 asc;
|
||||||
u8 ascq;
|
u8 ascq;
|
||||||
bool add_sector_info;
|
bool add_sense_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct sense_detail sense_detail_table[] = {
|
static const struct sense_detail sense_detail_table[] = {
|
||||||
@@ -3238,19 +3238,19 @@ static const struct sense_detail sense_detail_table[] = {
|
|||||||
.key = ABORTED_COMMAND,
|
.key = ABORTED_COMMAND,
|
||||||
.asc = 0x10,
|
.asc = 0x10,
|
||||||
.ascq = 0x01, /* LOGICAL BLOCK GUARD CHECK FAILED */
|
.ascq = 0x01, /* LOGICAL BLOCK GUARD CHECK FAILED */
|
||||||
.add_sector_info = true,
|
.add_sense_info = true,
|
||||||
},
|
},
|
||||||
[TCM_LOGICAL_BLOCK_APP_TAG_CHECK_FAILED] = {
|
[TCM_LOGICAL_BLOCK_APP_TAG_CHECK_FAILED] = {
|
||||||
.key = ABORTED_COMMAND,
|
.key = ABORTED_COMMAND,
|
||||||
.asc = 0x10,
|
.asc = 0x10,
|
||||||
.ascq = 0x02, /* LOGICAL BLOCK APPLICATION TAG CHECK FAILED */
|
.ascq = 0x02, /* LOGICAL BLOCK APPLICATION TAG CHECK FAILED */
|
||||||
.add_sector_info = true,
|
.add_sense_info = true,
|
||||||
},
|
},
|
||||||
[TCM_LOGICAL_BLOCK_REF_TAG_CHECK_FAILED] = {
|
[TCM_LOGICAL_BLOCK_REF_TAG_CHECK_FAILED] = {
|
||||||
.key = ABORTED_COMMAND,
|
.key = ABORTED_COMMAND,
|
||||||
.asc = 0x10,
|
.asc = 0x10,
|
||||||
.ascq = 0x03, /* LOGICAL BLOCK REFERENCE TAG CHECK FAILED */
|
.ascq = 0x03, /* LOGICAL BLOCK REFERENCE TAG CHECK FAILED */
|
||||||
.add_sector_info = true,
|
.add_sense_info = true,
|
||||||
},
|
},
|
||||||
[TCM_COPY_TARGET_DEVICE_NOT_REACHABLE] = {
|
[TCM_COPY_TARGET_DEVICE_NOT_REACHABLE] = {
|
||||||
.key = COPY_ABORTED,
|
.key = COPY_ABORTED,
|
||||||
@@ -3330,10 +3330,10 @@ static void translate_sense_reason(struct se_cmd *cmd, sense_reason_t reason)
|
|||||||
cmd->scsi_status = SAM_STAT_CHECK_CONDITION;
|
cmd->scsi_status = SAM_STAT_CHECK_CONDITION;
|
||||||
cmd->scsi_sense_length = TRANSPORT_SENSE_BUFFER;
|
cmd->scsi_sense_length = TRANSPORT_SENSE_BUFFER;
|
||||||
scsi_build_sense_buffer(desc_format, buffer, key, asc, ascq);
|
scsi_build_sense_buffer(desc_format, buffer, key, asc, ascq);
|
||||||
if (sd->add_sector_info)
|
if (sd->add_sense_info)
|
||||||
WARN_ON_ONCE(scsi_set_sense_information(buffer,
|
WARN_ON_ONCE(scsi_set_sense_information(buffer,
|
||||||
cmd->scsi_sense_length,
|
cmd->scsi_sense_length,
|
||||||
cmd->bad_sector) < 0);
|
cmd->sense_info) < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
@@ -540,7 +540,7 @@ struct se_cmd {
|
|||||||
struct scatterlist *t_prot_sg;
|
struct scatterlist *t_prot_sg;
|
||||||
unsigned int t_prot_nents;
|
unsigned int t_prot_nents;
|
||||||
sense_reason_t pi_err;
|
sense_reason_t pi_err;
|
||||||
sector_t bad_sector;
|
u64 sense_info;
|
||||||
int cpuid;
|
int cpuid;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user