[4583] in linux-scsi channel archive

home help back first fref pref prev next nref lref last post

Re: Panic in scsi.c

daemon@ATHENA.MIT.EDU (Kurt Garloff)
Wed Aug 19 21:59:48 1998

Date: 	Thu, 20 Aug 1998 00:40:00 +0200
From: Kurt Garloff <garloff@kg1.ping.de>
To: Richard Waltham <dormouse@farsrobt.demon.co.uk>,
        linux-kernel@vger.rutgers.edu, linux-scsi@vger.rutgers.edu
Cc: Chiaki Ishikawa <ishikawa@yk.rim.or.jp>, Alan Cox <alan@cymru.net>,
        Trevor Johnson <trevor@jpj.net>, info@lianelle.com.au
Mail-Followup-To: Richard Waltham <dormouse@farsrobt.demon.co.uk>,
	linux-kernel@vger.rutgers.edu, linux-scsi@vger.rutgers.edu,
	Chiaki Ishikawa <ishikawa@yk.rim.or.jp>, Alan Cox <alan@cymru.net>,
	Trevor Johnson <trevor@jpj.net>, info@lianelle.com.au
In-Reply-To: <199808190052.BAA14992@farsrobt.demon.co.uk>; from Richard Waltham on Wed, Aug 19, 1998 at 01:52:03AM +0100


--4Ckj6UjgE2iN1+kY
Content-Type: text/plain; charset=us-ascii

On Wed, Aug 19, 1998 at 01:52:03AM +0100, Richard Waltham wrote:
> Hi,
> 
> I can generate the following panic in scsi.c at will using a CD media
> changer - Nakamichi MBR-7.
> 
> Happens with kernel versions 2.0.35 and 2.0.36-pre6. I haven't checked any
> others.
> 
> 	Attempt to allocate device channel 0, target 6, lun x
> 	Kernel Panic: No Device found in allocate_device().
> 
> If I start the following two commands running in different vc's
> 
> dd if=/dev/scdX of=/dev/null   (X = 1, 2 ...)
> 
> dd if=/dev/scdY of=/dev/null   (Y = 0, 1 ...)
> 
> and the second one started has Y < X I get the panic.
> 
> eg 
> 
> dd if=/dev/sdc1 of=/dev/null    - starting this first
> 
> dd if=/dev/scd0 of=/dev/null    - then starting this
> 
> generates the panic. Starting scd0 first and then scd1 is OK - but very
> sloooooow as its spending most of the time changing CDs;)
> 
> I guess the panic is caused by the call to allocate_device from
> do_sr_request in sr.c but don't know why.
> 
> Anyone figure it out?

There have been reports that the code in scsi.c doesn't correctly honour the
BLIST_SINGLELUN and that this causes problems with Nakamichi MBR-7(2) and
certain host adapter settings. (Probably other devices will be affected too.)

Adding the NAKAMICHI to the blacklist (BLIST_SINGLELUN) and applying the
appended patch may help you. Chiaki Ishikawa reported successful operation
after creating the patch.

If I correctly judge what I see, this was a bug in scsi.c. Alan, is this bug
still in 2.0.36? (I'm not sure if it's the correct fix, though. There have
been reports about missing locking in sr.c, too ...)

-- 
Kurt Garloff, Dortmund 
<K.Garloff@ping.de>
PGP key on http://student.physik.uni-dortmund.de/homepages/garloff

--4Ckj6UjgE2iN1+kY
Content-Type: text/plain; charset=us-ascii
Content-Description: scsi-c-patch
Content-Disposition: attachment; filename=scsi-c-patch

*** 1.3	1998/08/06 13:31:25
--- linux/drivers/scsi/scsi.c	1998/08/09 19:27:19
***************
*** 64,70 ****
  #undef USE_STATIC_SCSI_MEMORY
  
  /*
! static const char RCSid[] = "$Header: /usr/src/linux-2.0.xx/drivers/scsi/RCS/scsi.c,v 1.3 1998/08/06 13:31:25 guest Exp $";
  */
  
  
--- 64,70 ----
  #undef USE_STATIC_SCSI_MEMORY
  
  /*
! static const char RCSid[] = "$Header: /usr/src/linux-2.0.xx/drivers/scsi/RCS/scsi.c,v 1.4 1998/08/07 08:20:32 guest Exp guest $";
  */
  
  
***************
*** 766,771 ****
--- 766,780 ----
    if ((bflags & BLIST_BORKEN) == 0)
      SDpnt->borken = 0;
  
+ /* ---moved as well --- */
+   /*
+    * If we want to only allow I/O to one of the luns attached to this device
+    * at a time, then we set this flag.
+    */
+   if (bflags & BLIST_SINGLELUN)
+     SDpnt->single_lun = 1;
+ 
+ 
    /*
     * These devices need this "key" to unlock the devices so we can use it
     */
***************
*** 808,813 ****
--- 817,823 ----
    if (bflags & BLIST_NOLUN)
      return 0;                   /* break; */
  
+   /* we duplicated the following above after borken */
    /*
     * If we want to only allow I/O to one of the luns attached to this device
     * at a time, then we set this flag.
***************
*** 961,966 ****
--- 971,985 ----
  	    SCpnt = SCpnt->device_next;
  	}
      } else {
+ 	/*
+ 	**
+       printk("single_lun: LINE=%d, (%d,%d,%d)\n",
+              __LINE__, 
+              device->channel,
+              device->id,
+              device->lun);
+         **
+ 	*/
  	SCpnt = device->host->host_queue;
  	while(SCpnt){
  	    if(SCpnt->channel == device->channel 
***************
*** 1092,1097 ****
--- 1111,1126 ----
  		SCpnt = SCpnt->device_next;
  	    }
  	} else {
+ 	/*
+ 	**
+           printk("single_lun: LINE=%d, (%d,%d,%d)\n",
+              __LINE__, 
+              device->channel,
+              device->id,
+              device->lun);
+ 	**
+ 	*/
+ 
  	    SCpnt = device->host->host_queue;
  	    while(SCpnt){
  		if(SCpnt->channel == device->channel


--4Ckj6UjgE2iN1+kY--

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu

home help back first fref pref prev next nref lref last post