Patchwork [Raring] (upstream)[libata] Fix HDIO_DRIVE_* ioctl() Linux 3.9 regression

login
register
mail settings
Submitter Dave Chiluk
Date Aug. 4, 2013, 9:52 a.m.
Message ID <1375609923-15655-1-git-send-email-chiluk@canonical.com>
Download mbox | patch
Permalink /patch/264505/
State New
Headers show

Comments

Dave Chiluk - Aug. 4, 2013, 9:52 a.m.
From: Krzysztof Mazur <krzysiek@podlesie.net>

BugLink: http://bugs.launchpad.net/bugs/1182247

On Mon, Mar 25, 2013 at 06:26:50PM +0100, Ronald wrote:
> In reply to [1]: I have the same issue. Git bisect took 50+ rebuilds xD
>
> Smartd does not work anymore since 84a9a8cd9 ([libata] Set proper SK
> when CK_COND is set.).

> [1] http://www.spinics.net/lists/linux-ide/msg45268.html

It seems that the SAM_STAT_CHECK_CONDITION is not cleared
causing -EIO, because that patch modified sensebuf and
the check for clearing SAM_STAT_CHECK_CONDITION is no longer valid.

Fix that.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
(cherry picked from commit 6d3bfc7be6f80d0c6ee6800d58d573343bf6e260)

Signed-off-by: Dave Chiluk <chiluk@canonical.com>
---
 drivers/ata/libata-scsi.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Tim Gardner - Aug. 4, 2013, 10:20 a.m.
This appears to be the result of some cherry picks (from yours truly) to 
enable Haswell SATA RTD3. https://bugs.launchpad.net/intel/+bug/1031180

Its worth noting that this issue is _not_ in vanilla stable 3.8.y.

Can you reference a comment in the bug report that indicates this commit 
positively fixes the problem ? The best test result I can find is that 
3.8.1 does not have the issue.

rtg
Tim Gardner - Aug. 4, 2013, 12:30 p.m.
The bug description was updated with positive test results:

Fix: Fix comes from upstream b7b2ee88b4c8d3326d144a051252d78bded93557. I 
have built and tested this fix and verified that it resolves the issue.

Testcase:
In the broken case)
$ sudo /usr/lib/nagios/plugins/check_ide_smart -d /dev/sda -i -n
CRITICAL - SMART_ENABLE: Input/output error
CRITICAL - SMART_CMD_ENABLE

After patch)
/usr/lib/nagios/plugins/check_ide_smart -n -d /dev/sda
OK - Operational (15/15 tests passed)

It would seem that check_ide_smart is defunct on my server, giving the 
following results when run manually:

sune@jadis:~$ sudo /usr/lib/nagios/plugins/check_ide_smart -d /dev/sda -i -n
CRITICAL - SMART_ENABLE: Input/output error
CRITICAL - SMART_CMD_ENABLE

rtg
Seth Forshee - Aug. 5, 2013, 7:39 a.m.

Tim Gardner - Aug. 5, 2013, 7:47 a.m.

Patch

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 318b413..ff44787 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -532,8 +532,8 @@  int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
 			struct scsi_sense_hdr sshdr;
 			scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE,
 					     &sshdr);
-			if (sshdr.sense_key == 0 &&
-			    sshdr.asc == 0 && sshdr.ascq == 0)
+			if (sshdr.sense_key == RECOVERED_ERROR &&
+			    sshdr.asc == 0 && sshdr.ascq == 0x1d)
 				cmd_result &= ~SAM_STAT_CHECK_CONDITION;
 		}
 
@@ -618,8 +618,8 @@  int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
 			struct scsi_sense_hdr sshdr;
 			scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE,
 						&sshdr);
-			if (sshdr.sense_key == 0 &&
-				sshdr.asc == 0 && sshdr.ascq == 0)
+			if (sshdr.sense_key == RECOVERED_ERROR &&
+			    sshdr.asc == 0 && sshdr.ascq == 0x1d)
 				cmd_result &= ~SAM_STAT_CHECK_CONDITION;
 		}