Skip to content

Commit fe16d4f

Browse files
committed
Revert "libata-eh: Set 'information' field for autosense"
This reverts commit a1524f2. As implemented, ACS-4 sense reporting for ATA devices bypasses error diagnosis and handling in libata degrading EH behavior significantly. Revert the related changes for now. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Hannes Reinecke <hare@suse.de> Cc: stable@vger.kernel.org #v4.1+
1 parent 8b34fe5 commit fe16d4f

6 files changed

Lines changed: 3 additions & 53 deletions

File tree

‎drivers/ata/libata-core.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,11 +694,11 @@ static int ata_rwcmd_protocol(struct ata_taskfile *tf, struct ata_device *dev)
694694
* RETURNS:
695695
* Block address read from @tf.
696696
*/
697-
u64 ata_tf_read_block(const struct ata_taskfile *tf, struct ata_device *dev)
697+
u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev)
698698
{
699699
u64 block = 0;
700700

701-
if (!dev || tf->flags & ATA_TFLAG_LBA) {
701+
if (tf->flags & ATA_TFLAG_LBA) {
702702
if (tf->flags & ATA_TFLAG_LBA48) {
703703
block |= (u64)tf->hob_lbah << 40;
704704
block |= (u64)tf->hob_lbam << 32;

‎drivers/ata/libata-eh.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1864,7 +1864,6 @@ void ata_eh_analyze_ncq_error(struct ata_link *link)
18641864
ata_dev_dbg(dev, "NCQ Autosense %02x/%02x/%02x\n",
18651865
sense_key, asc, ascq);
18661866
ata_scsi_set_sense(qc->scsicmd, sense_key, asc, ascq);
1867-
ata_scsi_set_sense_information(qc->scsicmd, &qc->result_tf);
18681867
qc->flags |= ATA_QCFLAG_SENSE_VALID;
18691868
}
18701869

@@ -1907,8 +1906,6 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc,
19071906
tmp = ata_eh_request_sense(qc, qc->scsicmd);
19081907
if (tmp)
19091908
qc->err_mask |= tmp;
1910-
else
1911-
ata_scsi_set_sense_information(qc->scsicmd, tf);
19121909
} else {
19131910
ata_dev_warn(qc->dev, "sense data available but port frozen\n");
19141911
}

‎drivers/ata/libata-scsi.c‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -280,18 +280,6 @@ void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq)
280280
scsi_build_sense_buffer(0, cmd->sense_buffer, sk, asc, ascq);
281281
}
282282

283-
void ata_scsi_set_sense_information(struct scsi_cmnd *cmd,
284-
const struct ata_taskfile *tf)
285-
{
286-
u64 information;
287-
288-
if (!cmd)
289-
return;
290-
291-
information = ata_tf_read_block(tf, NULL);
292-
scsi_set_sense_information(cmd->sense_buffer, information);
293-
}
294-
295283
static ssize_t
296284
ata_scsi_em_message_store(struct device *dev, struct device_attribute *attr,
297285
const char *buf, size_t count)

‎drivers/ata/libata.h‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag);
6767
extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
6868
u64 block, u32 n_block, unsigned int tf_flags,
6969
unsigned int tag);
70-
extern u64 ata_tf_read_block(const struct ata_taskfile *tf,
71-
struct ata_device *dev);
70+
extern u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev);
7271
extern unsigned ata_exec_internal(struct ata_device *dev,
7372
struct ata_taskfile *tf, const u8 *cdb,
7473
int dma_dir, void *buf, unsigned int buflen,
@@ -139,8 +138,6 @@ extern int ata_scsi_add_hosts(struct ata_host *host,
139138
extern void ata_scsi_scan_host(struct ata_port *ap, int sync);
140139
extern int ata_scsi_offline_dev(struct ata_device *dev);
141140
extern void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq);
142-
extern void ata_scsi_set_sense_information(struct scsi_cmnd *cmd,
143-
const struct ata_taskfile *tf);
144141
extern void ata_scsi_media_change_notify(struct ata_device *dev);
145142
extern void ata_scsi_hotplug(struct work_struct *work);
146143
extern void ata_schedule_scsi_eh(struct Scsi_Host *shost);

‎drivers/scsi/scsi_error.c‎

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include <linux/blkdev.h>
2727
#include <linux/delay.h>
2828
#include <linux/jiffies.h>
29-
#include <asm/unaligned.h>
3029

3130
#include <scsi/scsi.h>
3231
#include <scsi/scsi_cmnd.h>
@@ -2523,33 +2522,3 @@ void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq)
25232522
}
25242523
}
25252524
EXPORT_SYMBOL(scsi_build_sense_buffer);
2526-
2527-
/**
2528-
* scsi_set_sense_information - set the information field in a
2529-
* formatted sense data buffer
2530-
* @buf: Where to build sense data
2531-
* @info: 64-bit information value to be set
2532-
*
2533-
**/
2534-
void scsi_set_sense_information(u8 *buf, u64 info)
2535-
{
2536-
if ((buf[0] & 0x7f) == 0x72) {
2537-
u8 *ucp, len;
2538-
2539-
len = buf[7];
2540-
ucp = (char *)scsi_sense_desc_find(buf, len + 8, 0);
2541-
if (!ucp) {
2542-
buf[7] = len + 0xa;
2543-
ucp = buf + 8 + len;
2544-
}
2545-
ucp[0] = 0;
2546-
ucp[1] = 0xa;
2547-
ucp[2] = 0x80; /* Valid bit */
2548-
ucp[3] = 0;
2549-
put_unaligned_be64(info, &ucp[4]);
2550-
} else if ((buf[0] & 0x7f) == 0x70) {
2551-
buf[0] |= 0x80;
2552-
put_unaligned_be64(info, &buf[3]);
2553-
}
2554-
}
2555-
EXPORT_SYMBOL(scsi_set_sense_information);

‎include/scsi/scsi_eh.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ extern int scsi_get_sense_info_fld(const u8 * sense_buffer, int sb_len,
2828
u64 * info_out);
2929

3030
extern void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq);
31-
extern void scsi_set_sense_information(u8 *buf, u64 info);
3231

3332
extern int scsi_ioctl_reset(struct scsi_device *, int __user *);
3433

0 commit comments

Comments
 (0)