Using 2.3.42 I had a couple of problems with a multi-LUN CD-ROM changer.

First, I was getting a NULL dereference inside scsi_allocate_device.  This 
patch seems to fix it:

--- clean/linux/drivers/scsi/scsi.c     Sun Feb  6 12:28:31 2000
+++ linux/drivers/scsi/scsi.c   Sun Feb  6 12:31:01 2000
@@ -330,8 +330,7 @@
                                         * If asked to wait, we need to wait, otherwise
                                         * return NULL.
                                         */
-                                       SCpnt = NULL;
-                                       break;
+                                       goto wait;
                                }
                        }
                        /*
@@ -342,6 +341,7 @@
                                        break;
                        }
                }
+        wait:
                /*
                 * If we couldn't find a free command block, and we have been
                 * asked to wait, then do so.

But, with that patch applied, "insmod sr_mod" was hanging forever in this 
function.  It turns out that the SCSI bus scan was leaving `device_active' set 
to one.  This patch seems to avoid the problem:

--- clean/linux/drivers/scsi/scsi_scan.c        Sun Feb  6 12:28:31 2000
+++ linux/drivers/scsi/scsi_scan.c      Sun Feb  6 11:55:48 2000
@@ -262,7 +262,7 @@
        Scsi_Cmnd *SCpnt;
        unsigned char *scsi_result;
        unsigned char scsi_result0[256];
-       Scsi_Device *SDpnt;
+       Scsi_Device *SDpnt, *oldSDpnt;
        Scsi_Device *SDtail;
        int sparse_lun;
 
@@ -331,6 +331,7 @@
         */
        atomic_inc(&shpnt->host_active);
        atomic_inc(&SDpnt->device_active);
+       oldSDpnt = SDpnt;
 
        if (hardcoded == 1) {
                Scsi_Device *oldSDpnt = SDpnt;
@@ -412,7 +413,7 @@
         * so we know when everything is quiet.
         */
        atomic_dec(&shpnt->host_active);
-       atomic_dec(&SDpnt->device_active);
+       atomic_dec(&oldSDpnt->device_active);
 
       leave:

Could one of the experts please take a look?

Thanks
 
p.



-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]

Reply via email to