linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libata-scsi:  be tolerant of 12-byte ATAPI commands in 16-byte CDBs
       [not found]         ` <473B1B83.9020103@rtr.ca>
@ 2007-11-14 17:44           ` Mark Lord
  2007-11-14 17:50             ` Alan Cox
  2007-11-15  2:26             ` Tejun Heo
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Lord @ 2007-11-14 17:44 UTC (permalink / raw)
  To: Tejun Heo, IDE/ATA development list, Sebastian Kemper
  Cc: Jeff Garzik, Alan Cox, Linux Kernel

Sebastian Kemper reported that issuing CD/DVD commands under libata
is not fully compatible with ide-scsi.  In particular, the GPCMD_SET_STREAMING
was being rejected at the host level in some instances.

The reason is that libata-scsi insists upon the cmd_len field exactly matching
the SCSI opcode being issued, whereas ide-scsi tolerates 12-byte commands
contained within a 16-byte (cmd_len) CDB.

There doesn't seem to be a good reason for us to not be compatible there,
so here is a patch to fix libata-scsi to permit SCSI opcodes so long as
they fit within whatever size CDB is provided.

Signed-off-by: Mark Lord <mlord@pobox.com>
---

Patch is against 2.6.24-rc2-git4.
Sebastian, could you please re-test with this patch
and let us know that it works for you (or not).

--- old/drivers/ata/libata-scsi.c	2007-11-13 23:25:15.000000000 -0500
+++ linux/drivers/ata/libata-scsi.c	2007-11-14 12:32:16.000000000 -0500
@@ -2869,7 +2869,8 @@
 		xlat_func = NULL;
 		if (likely((scsi_op != ATA_16) || !atapi_passthru16)) {
 			/* relay SCSI command to ATAPI device */
-			if (unlikely(scmd->cmd_len > dev->cdb_len))
+			int len = COMMAND_SIZE(scsi_op);
+			if (unlikely(len > scmd->cmd_len || len > dev->cdb_len))
 				goto bad_cdb_len;
 
 			xlat_func = atapi_xlat;

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

* Re: [PATCH] libata-scsi:  be tolerant of 12-byte ATAPI commands in 16-byte CDBs
  2007-11-14 17:44           ` [PATCH] libata-scsi: be tolerant of 12-byte ATAPI commands in 16-byte CDBs Mark Lord
@ 2007-11-14 17:50             ` Alan Cox
  2007-11-15  2:26             ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Cox @ 2007-11-14 17:50 UTC (permalink / raw)
  To: Mark Lord
  Cc: Tejun Heo, IDE/ATA development list, Sebastian Kemper,
	Jeff Garzik, Alan Cox, Linux Kernel

On Wed, Nov 14, 2007 at 12:44:23PM -0500, Mark Lord wrote:
> Sebastian Kemper reported that issuing CD/DVD commands under libata
> is not fully compatible with ide-scsi.  In particular, the 
> GPCMD_SET_STREAMING
> was being rejected at the host level in some instances.
> 
> The reason is that libata-scsi insists upon the cmd_len field exactly 
> matching
> the SCSI opcode being issued, whereas ide-scsi tolerates 12-byte commands
> contained within a 16-byte (cmd_len) CDB.
> 
> There doesn't seem to be a good reason for us to not be compatible there,
> so here is a patch to fix libata-scsi to permit SCSI opcodes so long as
> they fit within whatever size CDB is provided.
> 
> Signed-off-by: Mark Lord <mlord@pobox.com>

Acked-by: Alan Cox <alan@redhat.com>


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

* Re: [PATCH] libata-scsi:  be tolerant of 12-byte ATAPI commands in 16-byte CDBs
  2007-11-14 17:44           ` [PATCH] libata-scsi: be tolerant of 12-byte ATAPI commands in 16-byte CDBs Mark Lord
  2007-11-14 17:50             ` Alan Cox
@ 2007-11-15  2:26             ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2007-11-15  2:26 UTC (permalink / raw)
  To: Mark Lord
  Cc: IDE/ATA development list, Sebastian Kemper, Jeff Garzik, Alan Cox,
	Linux Kernel

Mark Lord wrote:
> Sebastian Kemper reported that issuing CD/DVD commands under libata
> is not fully compatible with ide-scsi.  In particular, the
> GPCMD_SET_STREAMING
> was being rejected at the host level in some instances.
> 
> The reason is that libata-scsi insists upon the cmd_len field exactly
> matching
> the SCSI opcode being issued, whereas ide-scsi tolerates 12-byte commands
> contained within a 16-byte (cmd_len) CDB.
> 
> There doesn't seem to be a good reason for us to not be compatible there,
> so here is a patch to fix libata-scsi to permit SCSI opcodes so long as
> they fit within whatever size CDB is provided.
> 
> Signed-off-by: Mark Lord <mlord@pobox.com>

applied to #tj-upstream-fixes.

-- 
tejun

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

end of thread, other threads:[~2007-11-15  2:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20071113164323.GA5252@section-eight>
     [not found] ` <20071113212230.77cadecd@the-village.bc.nu>
     [not found]   ` <20071113232859.GA4681@section-eight>
     [not found]     ` <473B0FA2.5000102@rtr.ca>
     [not found]       ` <20071114153852.GA9019@section-eight>
     [not found]         ` <473B1B83.9020103@rtr.ca>
2007-11-14 17:44           ` [PATCH] libata-scsi: be tolerant of 12-byte ATAPI commands in 16-byte CDBs Mark Lord
2007-11-14 17:50             ` Alan Cox
2007-11-15  2:26             ` Tejun Heo

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