public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rene Herman <rene.herman@gmail.com>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Jens Axboe <jens.axboe@oracle.com>,
	Al Viro <viro@ftp.linux.org.uk>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: mcdx -- do_request(): non-read command to cd!!
Date: Mon, 02 Apr 2007 02:07:48 +0200	[thread overview]
Message-ID: <46104954.50608@gmail.com> (raw)
In-Reply-To: <4610481D.8000102@gmail.com>

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

On 04/02/2007 02:02 AM, Rene Herman wrote:

> On 04/01/2007 12:06 PM, Pekka Enberg wrote:
> 
>> Looks like mcdx_xfer is sleeping while holding q->queue_lock. The 
>> attached (untested) patch should fix it.
> 
> This (including your followup) does indeed avoid the traces in the 
> kernel log, but unfortunately, the driver seems to need a bit more.
> 
> This may be expected, I'm not sure:
> 
> root@5va2:~# dd if=/dev/mcdx0 of=/dev/null bs=2048
> 0+0 records in
> 0+0 records out
> 0 bytes (0 B) copied, 0.000221955 seconds, 0.0 kB/s
> root@5va2:~#
> 
> This I know isn't:
> 
> root@5va2:~# readcd dev=/dev/mcdx0 f=/dev/null
> Segmentation fault
> root@5va2:~#
> 
> (leaves a "note: readcd[1174] exited with preempt_count 1" in the log)
> 
> and after a "mount -t iso9660 /dev/mcdx0 /mnt/cdrom",  a:
> 
> root@5va2:~# tar cv /mnt/cdrom >/dev/null
> 
> has upto now done all of:
> 
> 1) segfault
> 2) make the kernel oops
> 3) reset the machine
> 
> This thing is just so badly broken... ;-(
> 
> I've attached the current patches from Jens and yourself (against 
> 2.6.20.4) as a double check, but the driver's still totally unuseable 
> even with them...

No, I didn't.

> I own two other legacy drives; a Panasonic CR562 (sbpcd.c) and a Sony 
> CDU33A (cdu31a.c) which together with this Mitsumi LU005S (mcdx.c) make 
> up also all but one of the controllers I have; a few standalone, but 
> most on old ISA soundcards. When I last tested, cdu31a somewhat worked 
> and sbpcd didn't. Had high hopes for mcdx.c upon seeing it compile 
> without warnings, but alas.
> 
> Last time Al Viro suggested ripping them out, I slightly objected:
> 
> http://lkml.org/lkml/2004/5/2/123
> 
> but well, although I like playing with this stuff, I still don't know 
> the first thing about the block layer and given the shape these things 
> are in...
> 
> Many thanks for looking though!

Rene.

[-- Attachment #2: mcdx.diff --]
[-- Type: text/plain, Size: 1562 bytes --]

--- drivers/cdrom/mcdx.c.orig	2007-04-02 00:25:09.000000000 +0200
+++ drivers/cdrom/mcdx.c	2007-04-02 00:37:53.000000000 +0200
@@ -577,11 +577,20 @@
 	if (!req)
 		return;
 
+	if (!blk_fs_request(req)) {
+		spin_lock_irq(q->queue_lock);
+		end_request(req, 0);
+		goto again;
+	}
+
+	spin_unlock_irq(q->queue_lock);
+
 	stuffp = req->rq_disk->private_data;
 
 	if (!stuffp->present) {
 		xwarn("do_request(): bad device: %s\n",req->rq_disk->disk_name);
 		xtrace(REQUEST, "end_request(0): bad device\n");
+		spin_lock_irq(q->queue_lock);
 		end_request(req, 0);
 		return;
 	}
@@ -589,6 +598,7 @@
 	if (stuffp->audio) {
 		xwarn("do_request() attempt to read from audio cd\n");
 		xtrace(REQUEST, "end_request(0): read from audio\n");
+		spin_lock_irq(q->queue_lock);
 		end_request(req, 0);
 		return;
 	}
@@ -596,9 +606,10 @@
 	xtrace(REQUEST, "do_request() (%lu + %lu)\n",
 	       req->sector, req->nr_sectors);
 
-	if (req->cmd != READ) {
+	if (rq_data_dir(req) != READ) {
 		xwarn("do_request(): non-read command to cd!!\n");
 		xtrace(REQUEST, "end_request(0): write\n");
+		spin_lock_irq(q->queue_lock);
 		end_request(req, 0);
 		return;
 	}
@@ -613,6 +624,7 @@
 					  req->nr_sectors);
 
 			if (i == -1) {
+				spin_lock_irq(q->queue_lock);
 				end_request(req, 0);
 				goto again;
 			}
@@ -620,10 +632,12 @@
 			req->nr_sectors -= i;
 			req->buffer += (i * 512);
 		}
+		spin_lock_irq(q->queue_lock);
 		end_request(req, 1);
 		goto again;
 
 		xtrace(REQUEST, "end_request(1)\n");
+		spin_lock_irq(q->queue_lock);
 		end_request(req, 1);
 	}
 

  reply	other threads:[~2007-04-02  0:09 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-30 21:21 mcdx -- do_request(): non-read command to cd!! Rene Herman
2007-03-31  6:47 ` Jens Axboe
2007-03-31 18:23   ` Rene Herman
2007-04-01 10:06     ` Pekka Enberg
2007-04-01 10:16       ` Pekka Enberg
2007-04-02  0:02       ` Rene Herman
2007-04-02  0:07         ` Rene Herman [this message]
2007-04-02  6:50           ` Pekka J Enberg
2007-04-02  7:10             ` Jens Axboe
2007-04-02  7:37               ` Pekka J Enberg
2007-04-02  8:55               ` Pekka J Enberg
2007-04-02  9:32                 ` Boaz Harrosh
2007-04-02  9:42                   ` Pekka J Enberg
2007-04-02  9:42                   ` Jens Axboe
2007-04-02 21:02                     ` Rene Herman
2007-04-02 15:18                 ` Rene Herman
2007-04-02 15:45                   ` Rene Herman
     [not found]                   ` <Pine.LNX.4.64.0704021837480.6518@sbz-30.cs.Helsinki.FI>
     [not found]                     ` <46112650.8080208@gmail.com>
     [not found]                       ` <Pine.LNX.4.64.0704021906040.7500@sbz-30.cs.Helsinki.FI>
     [not found]                         ` <461165FD.2010508@gmail.com>
     [not found]                           ` <Pine.LNX.4.64.0704030908420.20080@sbz-30.cs.Helsinki.FI>
     [not found]                             ` <Pine.LNX.4.64.0704030956330.20741@sbz-30.cs.Helsinki.FI>
2007-04-03 14:26                               ` Rene Herman
2007-04-03 17:37                                 ` Pekka J Enberg
     [not found]                               ` <461256C1.4020906@gmail.com>
2007-04-03 14:33                                 ` Pekka J Enberg
2007-04-03 17:31                                   ` Pekka J Enberg
2007-04-03 18:14                                     ` Rene Herman
2007-04-03 18:32                                       ` Pekka J Enberg
2007-04-04  2:10                                         ` Rene Herman
2007-04-04  6:30                                           ` Pekka Enberg
2007-04-04  6:19                                   ` Jens Axboe
2007-04-02 15:39               ` Rene Herman
2007-04-02  6:42         ` Jens Axboe
2007-04-02  7:07         ` Pekka Enberg

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=46104954.50608@gmail.com \
    --to=rene.herman@gmail.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=viro@ftp.linux.org.uk \
    /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