From: Andrew Morton <akpm@osdl.org>
To: "Ju, Seokmann" <Seokmann.Ju@lsil.com>
Cc: Seokmann.Ju@engenio.com, James.Bottomley@SteelEye.com,
linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH 1/1] megaraid_{mm,mbox}: fix a bug in reset handler
Date: Wed, 12 Apr 2006 22:00:11 -0700 [thread overview]
Message-ID: <20060412220011.2ddd6f63.akpm@osdl.org> (raw)
In-Reply-To: <890BF3111FB9484E9526987D912B261901BCC2@NAMAIL3.ad.lsil.com>
"Ju, Seokmann" <Seokmann.Ju@lsil.com> wrote:
>
> This patch has fix for a bug in the 'megaraid_reset_handler()'.
>
> When abort failed, the driver gets reset handleer called. In the reset
> handler, driver calls 'scsi_done()' callback for same SCSI command
> packet (struct scsi_cmnd) multiple times if there are multiple SCSI
> command packet in the pend_list. More over, if there are entry in the
> pend_lsit with IOCTL packet associated, the driver returns it to wrong
> free_list so that, in turn, the driver could end up with 'NULL pointer
> dereference..' during I/O command building with incorrect resource.
>
> Also, the patch contains several minor/cosmetic changes besides this.
>
> ..
>
> @@ -2655,32 +2655,48 @@
> // Also, reset all the commands currently owned by the driver
> spin_lock_irqsave(PENDING_LIST_LOCK(adapter), flags);
> list_for_each_entry_safe(scb, tmp, &adapter->pend_list, list) {
> -
> list_del_init(&scb->list); // from pending list
>
> - con_log(CL_ANN, (KERN_WARNING
> - "megaraid: %ld:%d[%d:%d], reset from pending list\n",
> - scp->serial_number, scb->sno,
> - scb->dev_channel, scb->dev_target));
> + if (scb->sno >= MBOX_MAX_SCSI_CMDS) {
> + con_log(CL_ANN, (KERN_WARNING
> + "megaraid: IOCTL packet with %d[%d:%d] being reset\n",
> + scb->sno, scb->dev_channel, scb->dev_target));
>
> - scp->result = (DID_RESET << 16);
> - scp->scsi_done(scp);
> + scb->status = -EFAULT;
What is the significance of -EFAULT here? Seems inappropriate?
> @@ -2918,12 +2933,12 @@
> wmb();
> WRINDOOR(raid_dev, raid_dev->mbox_dma | 0x1);
>
> - for (i = 0; i < 0xFFFFF; i++) {
> + for (i = 0; i < 0xFFFFFF; i++) {
> if (mbox->numstatus != 0xFF) break;
> rmb();
> }
Oh my. That's an awfully long interrupts-off spin. 1.7e7 operations with
an NMI watchdog timeout of five seconds - I'm surprised it doesn't trigger.
Is that reading from a PCI register there? Or main memory?
I'm somewhat surprised that the compiler never "optimises" this into a
lockup, actually. That's what `volatile' is for.
Is it not possible to do this with an interrupt?
A `cpu_relax()' in that loop would help cool things down a bit.
next prev parent reply other threads:[~2006-04-13 5:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-12 13:09 Ju, Seokmann
2006-04-13 5:00 ` Andrew Morton [this message]
2006-04-13 5:05 ` Andrew Morton
2006-04-15 7:10 ` Andre Hedrick
2006-04-15 14:00 ` James Bottomley
2006-04-17 13:12 Ju, Seokmann
2006-04-18 14:50 Ju, Seokmann
2006-04-18 16:33 ` Andre Hedrick
2006-04-18 20:37 ` Andrew Morton
2006-04-18 17:28 Ju, Seokmann
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=20060412220011.2ddd6f63.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=James.Bottomley@SteelEye.com \
--cc=Seokmann.Ju@engenio.com \
--cc=Seokmann.Ju@lsil.com \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®