Skip to contentSkip to conversation

ata: HDIO_DRIVE_* ioctl() Linux 3.9 regression

PATCH Superseded Ronald 5 participants 12 messages Mar 25, 2013 – Apr 3, 2013 libata

lore
Share & tools
lore

Ronald

author
#0 lore raw

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.).

I hope I'm not stepping on anyone's toe's by chosing the same title. I'm not subscribed to this list.

Just wanted to add a 'me2'

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

#1 lore raw
Quoted 11 lines · Ronald

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.).

I hope I'm not stepping on anyone's toe's by chosing the same title. I'm not subscribed to this list.

Just wanted to add a 'me2'

[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.

drivers/ata/libata-scsi.c +4 -4
index 318b413..ff44787 100644
@@ -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;
 		}
 

Krzysiek

Applied
#2 lore raw
Quoted 33 lines · Krzysztof Mazur
Quoted 11 lines · Ronald

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.).

I hope I'm not stepping on anyone's toe's by chosing the same title. I'm not subscribed to this list.

Just wanted to add a 'me2'

[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.

drivers/ata/libata-scsi.c +2 -2
index 318b413..ff44787 100644
@@ -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;
  		}
 

drivers/ata/libata-scsi.c int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg) · line 623

Quoted 8 lines
drivers/ata/libata-scsi.c +2 -2
@@ -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;

applied

#3 lore raw

PATCH 1/1 Fix HDIO_DRIVE_CMD ioctl sense data check

In reply to Ronald

commit 84a9a8cd9d0aa93c17e5815ab8a9cc4c0a765c63 changed the sense key used for returning task registers, but HDIO_DRIVE_CMD ioctl was not changed accordingly.

Tested: check that SMART ENABLE sent using HDIO_DRIVE_CMD returns 0 instead of EIO.

---
 drivers/ata/libata-scsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ata/libata-scsi.c +2 -2
index 318b413..e05bf4c 100644
@@ -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;
 		}
 
Signature · 1 line
1.8.1.3
#4 lore raw

Re: [PATCH] [libata] Fix HDIO_DRIVE_CMD ioctl sense data check

Quoted 29 lines · Gwendal Grignou

commit 84a9a8cd9d0aa93c17e5815ab8a9cc4c0a765c63 changed the sense key used for returning task registers, but HDIO_DRIVE_CMD ioctl was not changed accordingly.

Tested: check that SMART ENABLE sent using HDIO_DRIVE_CMD returns 0 instead of EIO.

---
 drivers/ata/libata-scsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ata/libata-scsi.c +2 -2
index 318b413..e05bf4c 100644
@@ -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;
 		}
 
Signature · 1 line
1.8.1.3

I did not test your patch, but I think that you missed the second test in ata_task_ioctl() and the kernel will still return -EIO in case of HDIO_DRIVE_TASK (0x31e) ioctl.
See http://marc.info/?l=linux-kernel&m=136438868606981&w=2.
The version I've sent fixes the problem for me.

Krzysiek

#5 lore raw

Re: [PATCH] [libata] Fix HDIO_DRIVE_CMD ioctl sense data check

Yours work.

Quoted 38 lines · Krzysztof Mazur
Quoted 28 lines · Gwendal Grignou

commit 84a9a8cd9d0aa93c17e5815ab8a9cc4c0a765c63 changed the sense key used for returning task registers, but HDIO_DRIVE_CMD ioctl was not changed accordingly.

Tested: check that SMART ENABLE sent using HDIO_DRIVE_CMD returns 0 instead of EIO.

---
 drivers/ata/libata-scsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ata/libata-scsi.c +2 -3
index 318b413..e05bf4c 100644
@@ -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;
              }
 
--
Quoted 1 line

1.8.1.3

I did not test your patch, but I think that you missed the second test in ata_task_ioctl() and the kernel will still return -EIO in case of HDIO_DRIVE_TASK (0x31e) ioctl.
See http://marc.info/?l=linux-kernel&m=136438868606981&w=2.
The version I've sent fixes the problem for me.

Krzysiek

#6 lore raw

PATCH v2 1/1 Fix HDIO_DRIVE_CMD ioctl sense data check

commit 84a9a8cd9d0aa93c17e5815ab8a9cc4c0a765c63 changed the sense key used for returning task registers, but HDIO_DRIVE_CMD ioctl was not changed accordingly.

Tested: check that SMART ENABLE sent using HDIO_DRIVE_CMD returns 0 instead of EIO.

Change-Id: I84dccd3febb0467a83a39e55ecfdaaa9686332cd

---
 drivers/ata/libata-scsi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/ata/libata-scsi.c +4 -4
index 318b413..5eae74b 100644
@@ -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;
 		}
 
Signature · 1 line
1.8.1.3
#7 lore raw

PATCH v2 1/1 Fix HDIO_DRIVE_CMD ioctl sense data check

commit 84a9a8cd9d0aa93c17e5815ab8a9cc4c0a765c63 changed the sense key used for returning task registers, but HDIO_DRIVE_CMD ioctl was not changed accordingly.

Tested: check that SMART ENABLE sent using HDIO_DRIVE_CMD returns 0 instead of EIO.

---
 drivers/ata/libata-scsi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/ata/libata-scsi.c +4 -4
index 318b413..5eae74b 100644
@@ -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;
 		}
 
Signature · 1 line
1.8.1.3
#8 lore raw

Re: [PATCH v2] [libata] Fix HDIO_DRIVE_CMD ioctl sense data check

Quoted 8 lines · Gwendal Grignou

commit 84a9a8cd9d0aa93c17e5815ab8a9cc4c0a765c63 changed the sense key used for returning task registers, but HDIO_DRIVE_CMD ioctl was not changed accordingly.

Tested: check that SMART ENABLE sent using HDIO_DRIVE_CMD returns 0 instead of EIO.

Works for me. If you like you can add:

Krzysiek

#9 lore raw

Re: [PATCH v2] [libata] Fix HDIO_DRIVE_CMD ioctl sense data check

In reply to Gwendal Grignou

Hello.

Quoted 1 line · Gwendal Grignou

commit 84a9a8cd9d0aa93c17e5815ab8a9cc4c0a765c63

Please, also specify that commit's summary line in parens
(or however you like).

Quoted 9 lines

changed the sense key
used for returning task registers, but HDIO_DRIVE_CMD ioctl was not changed accordingly.

Tested: check that SMART ENABLE sent using HDIO_DRIVE_CMD returns 0 instead of EIO.

MBR, Sergei

#10 lore raw

PATCH v3 1/1 Fix HDIO_DRIVE_CMD ioctl sense data check

commit 84a9a8 "Set proper SK when CK_COND is set" changed the sense key used for returning task registers, but HDIO_DRIVE_CMD ioctl was not changed accordingly.

Tested: check that SMART ENABLE sent using HDIO_DRIVE_CMD returns 0 instead of EIO.

---
 drivers/ata/libata-scsi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/ata/libata-scsi.c +4 -4
index 318b413..5eae74b 100644
@@ -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;
 		}
 
Signature · 1 line
1.8.1.3
#11 lore raw
In reply to Ronald

Ronald [and other],
Sorry for the bug I introduced. I just send a mail with a patch "[PATCH] [libata] Fix HDIO_DRIVE_CMD ioctl sense data check" that addresses the problem.

Gwendal.

Quoted 15 lines · Ronald

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.).

I hope I'm not stepping on anyone's toe's by chosing the same title. I'm not subscribed to this list.

Just wanted to add a 'me2'

[1] http://www.spinics.net/lists/linux-ide/msg45268.html
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html