]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.33.4/skip-sense-logging-for-some-ata-pass-through-cdbs.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.33.4 / skip-sense-logging-for-some-ata-pass-through-cdbs.patch
1 From e7efe5932b1d3916c79326a4221693ea90a900e2 Mon Sep 17 00:00:00 2001
2 From: Douglas Gilbert <dgilbert@interlog.com>
3 Date: Sun, 3 Jan 2010 13:51:15 -0500
4 Subject: [SCSI] skip sense logging for some ATA PASS-THROUGH cdbs
5
6 From: Douglas Gilbert <dgilbert@interlog.com>
7
8 commit e7efe5932b1d3916c79326a4221693ea90a900e2 upstream.
9
10 Further to the lsml thread titled:
11 "does scsi_io_completion need to dump sense data for ata pass through (ck_cond =
12 1) ?"
13
14 This is a patch to skip logging when the sense data is
15 associated with a SENSE_KEY of "RECOVERED_ERROR" and the
16 additional sense code is "ATA PASS-THROUGH INFORMATION
17 AVAILABLE". This only occurs with the SAT ATA PASS-THROUGH
18 commands when CK_COND=1 (in the cdb). It indicates that
19 the sense data contains ATA registers.
20
21 Smartmontools uses such commands on ATA disks connected via
22 SAT. Periodic checks such as those done by smartd cause
23 nuisance entries into logs that are:
24 - neither errors nor warnings
25 - pointless unless the cdb that caused them are also logged
26
27 Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
28 Signed-off-by: James Bottomley <James.Bottomley@suse.de>
29 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
30
31 ---
32 drivers/scsi/scsi_lib.c | 10 ++++++++--
33 1 file changed, 8 insertions(+), 2 deletions(-)
34
35 --- a/drivers/scsi/scsi_lib.c
36 +++ b/drivers/scsi/scsi_lib.c
37 @@ -773,8 +773,14 @@ void scsi_io_completion(struct scsi_cmnd
38 * we already took a copy of the original into rq->errors which
39 * is what gets returned to the user
40 */
41 - if (sense_valid && sshdr.sense_key == RECOVERED_ERROR) {
42 - if (!(req->cmd_flags & REQ_QUIET))
43 + if (sense_valid && (sshdr.sense_key == RECOVERED_ERROR)) {
44 + /* if ATA PASS-THROUGH INFORMATION AVAILABLE skip
45 + * print since caller wants ATA registers. Only occurs on
46 + * SCSI ATA PASS_THROUGH commands when CK_COND=1
47 + */
48 + if ((sshdr.asc == 0x0) && (sshdr.ascq == 0x1d))
49 + ;
50 + else if (!(req->cmd_flags & REQ_QUIET))
51 scsi_print_sense("", cmd);
52 result = 0;
53 /* BLOCK_PC may have set error */