public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Mathieu Fluhr <mfluhr@nero.com>
Cc: Arjan van de Ven <arjan@infradead.org>,
	Phillip Susi <psusi@cfl.rr.com>,
	jgarzik@pobox.com, linux-ide@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: READ SCSI cmd seems to fail on SATA optical devices...
Date: Wed, 15 Nov 2006 02:24:31 +0900	[thread overview]
Message-ID: <4559FBCF.9050203@gmail.com> (raw)
In-Reply-To: <1163519125.2998.8.camel@de-c-l-110.nero-de.internal>

[-- Attachment #1: Type: text/plain, Size: 1446 bytes --]

Mathieu Fluhr wrote:
> On Mon, 2006-11-13 at 20:32 +0100, Arjan van de Ven wrote:
>> On Mon, 2006-11-13 at 19:56 +0100, Mathieu Fluhr wrote:
>>> On Mon, 2006-11-13 at 13:49 -0500, Phillip Susi wrote:
>>>> Mathieu Fluhr wrote:
>>>>> Hello,
>>>>>
>>>>> I recently tried to burn some datas on CDs and DVD using a SATA burner
>>>>> and the latest 2.6.18.2 kernel... using NeroLINUX. (It is controlling
>>>>> the device by sending SCSI commands over the 'sg' driver)
>>>>>
>>>> Please note that the sg interface is depreciated.  It is now recommended 
>>>> that you send the CCBs directly to the normal device, i.e. /dev/hdc.
>>> Of course for native IDE devices, we are using the /dev/hdXX device, but
>>> for SATA devices controlled by the libata, this is not possible ;)
>> for those there is /dev/scd0 etc...
>> (usually nicely symlinked to /dev/cdrom)
> 
> Hummm as we are _writing_ to devices, I think that using /dev/sgXX with
> SG_IO is better no?

The recommended way is using SG_IO to /dev/srX (or /dev/scdX).

> ... and the problem is not in accessing the device itself (this is
> working like a charm) but understanding why a SCSI READ(10) cmd
> sometimes fails as a ATA-padded READ(10) cmd - as discribed in the Annex
> A of the MMC-5 spec - ALWAYS works.
> -> I would suspect somehow a synchronisation problem somehow in the
> translation of SCSI to ATA command...

Can you try the attached patch and see if anything changes?

-- 
tejun

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 828 bytes --]

diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 2dc3264..fa82151 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -286,6 +286,7 @@ static int sg_io(struct file *file, requ
 	 * fill in request structure
 	 */
 	rq->cmd_len = hdr->cmd_len;
+	memset(rq->cmd, 0, BLK_MAX_CDB);
 	memcpy(rq->cmd, cmd, hdr->cmd_len);
 	if (sizeof(rq->cmd) != hdr->cmd_len)
 		memset(rq->cmd + hdr->cmd_len, 0, sizeof(rq->cmd) - hdr->cmd_len);
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index d2c02df..080c2ed 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -410,6 +410,7 @@ int scsi_execute_async(struct scsi_devic
 		goto free_req;
 
 	req->cmd_len = cmd_len;
+	memset(req->cmd, 0, BLK_MAX_CDB);
 	memcpy(req->cmd, cmd, req->cmd_len);
 	req->sense = sioc->sense;
 	req->sense_len = 0;

  reply	other threads:[~2006-11-14 17:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-13 16:19 READ SCSI cmd seems to fail on SATA optical devices Mathieu Fluhr
2006-11-13 18:49 ` Phillip Susi
2006-11-13 18:56   ` Mathieu Fluhr
2006-11-13 19:32     ` Arjan van de Ven
2006-11-14 15:45       ` Mathieu Fluhr
2006-11-14 17:24         ` Tejun Heo [this message]
2006-11-15 15:19           ` Mathieu Fluhr
2006-11-15 16:04             ` Tejun Heo
2006-11-15 16:17               ` Phillip Susi
2006-11-15 16:20                 ` Arjan van de Ven
2006-11-15 16:28                 ` Alan
2006-11-14  2:02 ` Tejun Heo
2006-11-14 10:08   ` Mathieu Fluhr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4559FBCF.9050203@gmail.com \
    --to=htejun@gmail.com \
    --cc=arjan@infradead.org \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mfluhr@nero.com \
    --cc=psusi@cfl.rr.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox