linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Jan Engelhardt <jengelh@medozas.de>,
	Boaz Harrosh <bharrosh@panasas.com>,
	linux-scsi@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-ide <linux-ide@vger.kernel.org>,
	FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Subject: Re: [BUG] 2.6.29-rc6-2450cf in scsi_lib.c (was: Large amount of scsi-sgpool)objects
Date: Wed, 04 Mar 2009 12:55:06 -0600	[thread overview]
Message-ID: <1236192906.18999.5.camel@localhost.localdomain> (raw)
In-Reply-To: <alpine.LFD.2.00.0903040249460.29264@localhost.localdomain>

On Wed, 2009-03-04 at 03:01 +0100, Thomas Gleixner wrote: 
> On Tue, 3 Mar 2009, James Bottomley wrote:
> 
> > On Tue, 2009-03-03 at 23:07 +0100, Thomas Gleixner wrote:
> > > On Tue, 3 Mar 2009, Thomas Gleixner wrote:
> > > > My bad. I was playing with that to get rid of the aic7xxx wreckage on
> > > > one of my test boxen and forgot to remove it.
> > > 
> > > While the one below is definitey not my fault. It's on Linus latest:
> > > 
> > >  commit 2450cf51a1bdba7037e91b1bcc494b01c58aaf66
> > > 
> > > While compiling a kernel I triggerred the BUG below. Not so nice as it
> > > took a whole filesystem with it. fsck took more than 20 min to recover
> > > the leftovers :(
> > > 
> > > Thanks,
> > > 
> > > 	tglx
> > > 
> > > 
> > > ------------[ cut here ]------------
> > > kernel BUG at /home/tglx/work/kernel/git/linux-2.6/drivers/scsi/scsi_lib.c:1141!
> > 
> > This is BUG_ON(count > sdb->table.nents);
> > 
> > It looks like the sg list got split and grew in size ... I suspect this
> > might be libata related, so cc'ing the ide list.  I suspect either the
> > block layer initially parametrised this wrongly (tomo bug) or a sg list
> > got split then requeued (something in libata?).
> 
> FYI, after I've lost a full day of work including the results of four
> "iozone -a -g 4G" runs I tried to reproduce the problem on that
> machine - the leftovers of the filesystem are pretty useless anyway.
> 
> It took about 2hrs to trigger the bug again. Same back trace.
> 
> Anything I can do what might help to decode the problem ?

I discussed this with Fujita Tomonori ... we think it's probably in the
generic block merging code. 

Could you run with this debugging code added until the fault triggers so
we can get an exact view of what the layout of the request is and why
we're getting an extra segment on mapping?

Thanks,

James

P.S. I think if you take the BUG() statement out, as long as it's only
one segment over, the machine should stay up long enough for a clean
shutdown.

---

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 940dc32..5219153 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1139,7 +1139,33 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb,
 	 * each segment.
 	 */
 	count = blk_rq_map_sg(req->q, req, sdb->table.sgl);
-	BUG_ON(count > sdb->table.nents);
+	if (unlikely(count > sdb->table.nents)) {
+		struct bio_vec *bvec;
+		struct req_iterator iter;
+		struct scatterlist *sg;
+		int i=0;
+
+		printk(KERN_ERR "MAPPING miscount %d phys maps to %d\n",
+		       sdb->table.nents, count);
+		blk_dump_rq_flags(req, "Request Flags");
+		
+		printk("DUMPING REQUEST LIST:\n");
+		rq_for_each_segment(bvec, req, iter) {
+			printk("[%d]: phys 0x%lx len 0x%x\n", i,
+			       (unsigned long)page_to_phys(bvec->bv_page) + bvec->bv_offset,
+			       bvec->bv_len);
+			i++;
+		}
+		printk("DUMPING MAPPED LIST:\n");
+		for_each_sg(sdb->table.sgl, sg, count, i) {
+			printk("[%d]: phys 0x%lx len 0x%x\n", i,
+			       (unsigned long)page_to_phys(sg_page(sg)) + sg->offset,
+			       sg->length);
+		}
+		BUG();
+	}
+			
+
 	sdb->table.nents = count;
 	if (blk_pc_request(req))
 		sdb->length = req->data_len;



  reply	other threads:[~2009-03-04 18:55 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-03  1:28 Large amount of scsi-sgpool objects Jan Engelhardt
2009-03-03  9:31 ` Boaz Harrosh
2009-03-03 15:21   ` James Bottomley
2009-03-03 16:08     ` Jan Engelhardt
2009-03-03 16:24       ` Boaz Harrosh
2009-03-03 17:59         ` Alan Stern
2009-03-03 20:56           ` Ingo Molnar
2009-03-03 21:06             ` Alan Stern
2009-03-03 16:25       ` James Bottomley
2009-03-03 17:19         ` Thomas Gleixner
2009-03-03 22:07           ` [BUG] 2.6.29-rc6-2450cf in scsi_lib.c (was: Large amount of scsi-sgpool)objects Thomas Gleixner
2009-03-03 22:22             ` Jan Engelhardt
2009-03-03 23:07               ` Thomas Gleixner
2009-03-03 22:26             ` James Bottomley
2009-03-04  2:01               ` Thomas Gleixner
2009-03-04 18:55                 ` James Bottomley [this message]
2009-03-04 21:45                 ` Thomas Gleixner
2009-03-04 22:56                   ` James Bottomley
2009-03-05  0:13                     ` James Bottomley
2009-03-05  8:36                     ` FUJITA Tomonori
2009-03-05  8:39                       ` FUJITA Tomonori
2009-03-05  9:29                         ` FUJITA Tomonori
2009-03-05 10:09                           ` Jens Axboe
2009-03-05 10:14                             ` Jens Axboe
2009-03-05 10:27                               ` FUJITA Tomonori
2009-03-05 10:30                                 ` Jens Axboe
2009-03-05 10:41                                   ` FUJITA Tomonori
2009-03-05 11:10                                     ` Jens Axboe
2009-03-05 11:40                                       ` FUJITA Tomonori
2009-03-05 10:41                                   ` Ingo Molnar
2009-03-05 11:05                                     ` Jens Axboe
2009-03-05 11:07                                       ` Ingo Molnar
2009-03-05 12:09                                         ` Thomas Gleixner
2009-03-05 23:16                                           ` Thomas Gleixner
2009-03-05 19:32                                         ` Ingo Molnar
2009-03-05 10:15                             ` Ingo Molnar
2009-03-03 19:22         ` Large amount of scsi-sgpool objects Ingo Molnar
2009-03-03 21:25           ` James Bottomley
2009-03-03 21:44             ` Ingo Molnar
2009-03-03 22:39               ` James Bottomley
2009-03-03 23:03                 ` Ingo Molnar
2009-03-03 23:32                   ` Stefan Richter
2009-03-03 23:48                     ` Ingo Molnar
2009-03-04  6:39                       ` Stefan Richter
2009-03-04  7:12                         ` Mike Galbraith
2009-03-04  7:50                           ` Stefan Richter
2009-03-04  8:00                             ` Mike Galbraith
2009-03-04  9:06                             ` Thomas Gleixner
2009-03-04 11:12                               ` Ingo Molnar
2009-03-04 11:28                                 ` Stefan Richter
2009-03-04 11:47                                   ` Ingo Molnar
2009-03-04 12:02                                     ` Stefan Richter
2009-03-04 11:24                             ` Ingo Molnar
2009-03-04 19:11                               ` Andrew Morton
2009-03-04 20:09                                 ` Thomas Gleixner
2009-03-04  0:01                   ` James Bottomley
2009-03-04  0:39                     ` Ingo Molnar
2009-03-04  0:30                 ` Thomas Gleixner
2009-03-04  0:47                   ` Ingo Molnar

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=1236192906.18999.5.camel@localhost.localdomain \
    --to=james.bottomley@hansenpartnership.com \
    --cc=bharrosh@panasas.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=jengelh@medozas.de \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).