linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [QUESTION] in ata_scsi_pass_thru()
@ 2005-11-30  7:39 Tejun Heo
  2005-12-02  1:59 ` Jeff Garzik
  0 siblings, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2005-11-30  7:39 UTC (permalink / raw)
  To: russb, Jeff Garzik, Linux-ide

Hi, all.

In the translation function ata_scsi_pass_thru(), when it determines 
that the command cannot be translated and should be finished early, it 
does NOT set sense data or result code.  This seems buggy.  Is this 
intentional?

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [QUESTION] in ata_scsi_pass_thru()
  2005-11-30  7:39 [QUESTION] in ata_scsi_pass_thru() Tejun Heo
@ 2005-12-02  1:59 ` Jeff Garzik
  2005-12-02  2:49   ` [PATCH] libata: fix ata_scsi_pass_thru error handling Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Garzik @ 2005-12-02  1:59 UTC (permalink / raw)
  To: Tejun Heo; +Cc: russb, Linux-ide

Tejun Heo wrote:
> Hi, all.
> 
> In the translation function ata_scsi_pass_thru(), when it determines 
> that the command cannot be translated and should be finished early, it 
> does NOT set sense data or result code.  This seems buggy.  Is this 
> intentional?

Yes, a bug.

	Jeff




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] libata: fix ata_scsi_pass_thru error handling
  2005-12-02  1:59 ` Jeff Garzik
@ 2005-12-02  2:49   ` Tejun Heo
  2005-12-04  1:31     ` Jeff Garzik
  0 siblings, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2005-12-02  2:49 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: russb, Linux-ide

This patch makes ata_scsi_pass_thru() properly set result code and
sense data on translation failures.

Signed-off-by: Tejun Heo <htejun@gmail.com>

diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 957a9ca..7445d8b 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -2233,7 +2233,7 @@ ata_scsi_pass_thru(struct ata_queued_cmd
 	struct scsi_cmnd *cmd = qc->scsicmd;
 
 	if ((tf->protocol = ata_scsi_map_proto(scsicmd[1])) == ATA_PROT_UNKNOWN)
-		return 1;
+		goto invalid_fld;
 
 	/*
 	 * 12 and 16 byte CDBs use different offsets to
@@ -2295,7 +2295,7 @@ ata_scsi_pass_thru(struct ata_queued_cmd
 	 */
 	if ((tf->command == ATA_CMD_SET_FEATURES)
 	 && (tf->feature == SETFEATURES_XFER))
-		return 1;
+		goto invalid_fld;
 
 	/*
 	 * Set flags so that all registers will be written,
@@ -2316,6 +2316,11 @@ ata_scsi_pass_thru(struct ata_queued_cmd
 	qc->nsect = cmd->bufflen / ATA_SECT_SIZE;
 
 	return 0;
+
+ invalid_fld:
+	ata_scsi_set_sense(qc->scsicmd, ILLEGAL_REQUEST, 0x24, 0x00);
+	/* "Invalid field in cdb" */
+	return 1;
 }
 
 /**

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] libata: fix ata_scsi_pass_thru error handling
  2005-12-02  2:49   ` [PATCH] libata: fix ata_scsi_pass_thru error handling Tejun Heo
@ 2005-12-04  1:31     ` Jeff Garzik
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2005-12-04  1:31 UTC (permalink / raw)
  To: Tejun Heo; +Cc: russb, Linux-ide

applied


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-12-04  1:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-30  7:39 [QUESTION] in ata_scsi_pass_thru() Tejun Heo
2005-12-02  1:59 ` Jeff Garzik
2005-12-02  2:49   ` [PATCH] libata: fix ata_scsi_pass_thru error handling Tejun Heo
2005-12-04  1:31     ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).