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/
-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html