public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: linux-scsi@vger.kernel.org
Cc: linux1394-user@lists.sourceforge.net
Subject: patch (was Usage question)
Date: Wed, 04 May 2005 23:19:50 +0200	[thread overview]
Message-ID: <42793C76.5010807@s5r6.in-berlin.de> (raw)
In-Reply-To: <1112492302.20936.12.camel@kino.dennedy.org>

Dan Dennedy wrote on 2005-04-03:
> On Sat, 2005-04-02 at 15:55 +0200, Matthias Bläsing wrote:
[hotplugging of SBP-2 CD-ROMs]
>>There was a patch for the kernel on this list, which work quite good for
>>me (sr.c and sr_ioctl.c have to be modified - Olaf Hering on
>>24.10.2004). I couldn't find any bad side effects of this.
> 
> Thanks, I located the message on the linux1394-devel list:
> http://marc.theaimsgroup.com/?l=linux1394-devel&m=109862922621832&w=2
> 
> There is a very good report response to Olaf's little patch.
> http://marc.theaimsgroup.com/?l=linux1394-devel&m=109925711513542&w=2
> 
> Please, others, try it as well. I'm going to....

I tried it with up to two different CD-RWs and a HDD on the same FireWire
bus. Works for me. There have been other positive reports on linux1394-user
as well. Quote from Olaf's posting:

| The trouble starts in register_cdrom(), it sets the ->exit() function if
| the CD can do CDC_MRW_W.
| On unregister, it tries to send a packet to the device which is already
| gone.
|
| How about this patch?

diff -purN linux-2.6.9.orig/drivers/scsi/sr.c linux-2.6.9-olh/drivers/scsi/sr.c
--- linux-2.6.9.orig/drivers/scsi/sr.c	2004-10-22 19:02:43.545400072 +0200
+++ linux-2.6.9-olh/drivers/scsi/sr.c	2004-10-24 16:32:10.765682704 +0200
@@ -916,6 +918,7 @@ static void sr_kref_release(struct kref
  	struct gendisk *disk = cd->disk;

  	spin_lock(&sr_index_lock);
+	cd->use = 0;
  	clear_bit(disk->first_minor, sr_index_bits);
  	spin_unlock(&sr_index_lock);

diff -purN linux-2.6.9.orig/drivers/scsi/sr_ioctl.c linux-2.6.9-olh/drivers/scsi/sr_ioctl.c
--- linux-2.6.9.orig/drivers/scsi/sr_ioctl.c	2004-10-22 19:02:43.547399768 +0200
+++ linux-2.6.9-olh/drivers/scsi/sr_ioctl.c	2004-10-24 16:31:05.921540512 +0200
@@ -86,6 +86,11 @@ int sr_do_ioctl(Scsi_CD *cd, struct pack
          struct request *req;
  	int result, err = 0, retries = 0;

+	if(!cd->use) {
+		err = -ENODEV;
+		goto out;
+	}
+
  	SDev = cd->device;
  	SRpnt = scsi_allocate_request(SDev, GFP_KERNEL);
          if (!SRpnt) {


-- 
Stefan Richter
-=====-=-=-= -=-= --=--
http://arcgraph.de/sr/
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2005-05-04 21:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1112394885.6487.9.camel@localhost.localdomain>
     [not found] ` <424DFE79.4080003@s5r6.in-berlin.de>
     [not found]   ` <1112450118.5518.3.camel@defiant>
2005-04-03  1:38     ` Usage question Dan Dennedy
2005-05-04 21:19       ` Stefan Richter [this message]
2005-05-13 10:43       ` Olaf Hering

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=42793C76.5010807@s5r6.in-berlin.de \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux1394-user@lists.sourceforge.net \
    /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