public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Vasquez <andrew.vasquez@qlogic.com>
To: James.Smart@Emulex.Com, linux-scsi@vger.kernel.org
Subject: Re: [PATCH 2/2  scsi-rc-fixes-2.6] FC Remote Port patch
Date: Thu, 10 Feb 2005 10:56:17 -0800	[thread overview]
Message-ID: <20050210185617.GA13971@plap.san.rr.com> (raw)
In-Reply-To: <20050209230350.GA10297@plap.qlogic.org>

On Wed, 09 Feb 2005, Andrew Vasquez wrote:
> On Wed, 09 Feb 2005, James.Smart@Emulex.Com wrote:
> 
> > > seems like sdev->shost is bogus when fc_remote_port_block() is
> > > called...
> > 
> > We haven't seen this in our testing....
> > 
> 
> Actually it's not the sdev->host that's bogus -- it appears the sdev
> is referenced after it's been freed -- a reference still present in
> the shost->__devices list.  Here's the scenario:
> 
...
> 	Unable to handle kernel paging request at virtual address 6b6b6be7
> 	 printing eip:
> 	c028ef06
> 	*pde = 00000000
> 	Oops: 0000 [#1]
> 	SMP
> 	Modules linked in: qla2322 qla2xxx
> 	CPU:    0
> 	EIP:    0060:[<c028ef06>]    Not tainted VLI
> 	EFLAGS: 00010086   (2.6.11-rport)
> 	EIP is at scsi_device_get+0x56/0xa0
> 	eax: 6b6b6b6b   ebx: dd2bc738   ecx: c035f844   edx: fffffffa
> 	esi: dd2bc8cc   edi: d36f0000   ebp: 00000001   esp: df693dd4
> 	ds: 007b   es: 007b   ss: 0068
> 	Process qla2322_1_dpc (pid: 11316, threadinfo=df692000 task=d9fa8530)
> 	Stack: c0341fcc dd2bc738 6b6b6b6b 6b6b6b6b dd2bc8cc dd2bc738 d76196f0 c028f011
> 	       c0341ff4 00000000 dd2bc738 6b6b6b6b 6b6b6b6b dd2bc8cc 6b6b6b6b 00000282
> 	       d76196e8 d76196e8 ddd7e790 d36f0000 c029af50 c028f0bd 00000000 dbe8512c
> 	Cale Trace:
> 	 [<c028f011>] __scsi_iterate_devices+0x71/0xb0
> 	 [<c029af50>] fc_device_block+0x0/0x10
> 	 [<c028f0bd>] starget_for_each_device+0x6d/0x80
> 	 [<c029afff>] fc_remote_port_block+0x3f/0x70
> 	 [<e08633d3>] qla2x00_mark_device_lost+0x53/0xe0 [qla2xxx]
> 

Ok, there seems to also be some sdev reference counting issues --
within scsi_alloc_sdev() we are never tearing-down the the
cooresponding starget references created within
scsi_sysfs_target_initialize().

> Another quirk when run with no storage connected to HBAs and the
> driver is loaded, then unloaded -- is a consistent BUG() hit in
> _raw_spin_lock() via scsi_forget_host():
> 
> 	kernel BUG at include/asm/spinlock.h:149!
> 	invalid operand: 0000 [#1]

this issue also appears to be fixed with the patch.

--
AV


diff -urd 1.8/drivers/scsi/scsi_scan.c edited/drivers/scsi/scsi_scan.c
--- 1.8/drivers/scsi/scsi_scan.c	2005-02-09 11:30:52 -08:00
+++ edited/drivers/scsi/scsi_scan.c	2005-02-10 10:16:44 -08:00
@@ -248,8 +248,10 @@
 
 	spin_lock_init(&sdev->sdev_lock);
 	sdev->request_queue = scsi_alloc_queue(sdev);
-	if (!sdev->request_queue)
-		goto out_free_dev;
+	if (!sdev->request_queue) {
+		kfree(sdev);
+		goto out;
+	}
 
 	sdev->request_queue->queuedata = sdev;
 	scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
@@ -284,8 +286,7 @@
 out_device_destroy:
 	transport_destroy_device(&sdev->sdev_gendev);
 	scsi_free_queue(sdev->request_queue);
-out_free_dev:
-	kfree(sdev);
+	put_device(&sdev->sdev_gendev);
 out:
 	if (display_failure_msg)
 		printk(ALLOC_FAILURE_MSG, __FUNCTION__);

  reply	other threads:[~2005-02-10 21:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-09 19:24 [PATCH 2/2 scsi-rc-fixes-2.6] FC Remote Port patch James.Smart
2005-02-09 23:03 ` Andrew Vasquez
2005-02-10 18:56   ` Andrew Vasquez [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-02-09 18:07 James.Smart
2005-02-09  4:18 James.Smart
2005-02-09  8:15 ` Mike Christie
2005-02-09 18:09 ` Christoph Hellwig
2005-02-09 18:32 ` Andrew Vasquez

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=20050210185617.GA13971@plap.san.rr.com \
    --to=andrew.vasquez@qlogic.com \
    --cc=James.Smart@Emulex.Com \
    --cc=linux-scsi@vger.kernel.org \
    /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