From: Andrew Morton <akpm@osdl.org>
To: Jens Axboe <axboe@suse.de>
Cc: neilb@cse.unsw.edu.au, phil@dier.us, linux-kernel@vger.kernel.org
Subject: Re: oops with dual xeon 2.8ghz 4gb ram +smp, software raid, lvm, and xfs
Date: Wed, 24 Nov 2004 23:08:38 -0800 [thread overview]
Message-ID: <20041124230838.4d639c6d.akpm@osdl.org> (raw)
In-Reply-To: <20041125065728.GA10233@suse.de>
Jens Axboe <axboe@suse.de> wrote:
>
> On Thu, Nov 25 2004, Neil Brown wrote:
> > On Wednesday November 24, akpm@osdl.org wrote:
> > > Neil Brown <neilb@cse.unsw.edu.au> wrote:
> > > >
> > > > Would the following (untested-but-seems-to-compile -
> > > > explanation-of-concept) patch be at all reasonable to avoid stack
> > > > depth problems with stacked block devices, or is adding stuff to
> > > > task_struct frowned upon?
> > >
> > > It's always a tradeoff - we've put things in task_struct before to get
> > > around sticky situations. Certainly, removing potentially unbounded stack
> > > utilisation is a worthwhile thing to do.
> > >
> > > The patch bends my brain a bit.
> >
> > Recursion is like that (... like recursion, that is :-).
>
> Pardon my ignorance, but where is the bug that called for something like
> this?
Well there was an xfs-on-raid-on-lvm stack overrun reported, but the
general problem we're addressing here is that stacking drivers can cause
arbitrary amounts of kernel stack windup.
> I can't say I love the idea of adding a bio list structure to the
> tasklist, it feels pretty hacky. generic_make_request() doesn't really
> use that much stack, if you just kill the BDEVNAME_SIZE struct.
Looks like a sensible thing to do, although it would be tidier to move the
whole thing into a separate function, no?
--- 25/drivers/block/ll_rw_blk.c~generic_make_request-stack-savings 2004-11-24 23:03:06.347778648 -0800
+++ 25-akpm/drivers/block/ll_rw_blk.c 2004-11-24 23:07:39.798207864 -0800
@@ -2584,6 +2584,20 @@ static inline void block_wait_queue_runn
}
}
+static void handle_bad_sector(struct bio *bio)
+{
+ char b[BDEVNAME_SIZE];
+
+ printk(KERN_INFO "attempt to access beyond end of device\n");
+ printk(KERN_INFO "%s: rw=%ld, want=%Lu, limit=%Lu\n",
+ bdevname(bio->bi_bdev, b),
+ bio->bi_rw,
+ (unsigned long long)bio->bi_sector + bio_sectors(bio),
+ (long long)(bio->bi_bdev->bd_inode->i_size >> 9));
+
+ set_bit(BIO_EOF, &bio->bi_flags);
+}
+
/**
* generic_make_request: hand a buffer to its device driver for I/O
* @bio: The bio describing the location in memory and on the device.
@@ -2620,21 +2634,13 @@ void generic_make_request(struct bio *bi
if (maxsector) {
sector_t sector = bio->bi_sector;
- if (maxsector < nr_sectors ||
- maxsector - nr_sectors < sector) {
- char b[BDEVNAME_SIZE];
- /* This may well happen - the kernel calls
- * bread() without checking the size of the
- * device, e.g., when mounting a device. */
- printk(KERN_INFO
- "attempt to access beyond end of device\n");
- printk(KERN_INFO "%s: rw=%ld, want=%Lu, limit=%Lu\n",
- bdevname(bio->bi_bdev, b),
- bio->bi_rw,
- (unsigned long long) sector + nr_sectors,
- (long long) maxsector);
-
- set_bit(BIO_EOF, &bio->bi_flags);
+ if (maxsector < nr_sectors || maxsector - nr_sectors < sector) {
+ /*
+ * This may well happen - the kernel calls bread()
+ * without checking the size of the device, e.g., when
+ * mounting a device.
+ */
+ handle_bad_sector(bio);
goto end_io;
}
}
_
next prev parent reply other threads:[~2004-11-25 7:14 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-22 19:06 Phil Dier
2004-11-23 0:17 ` Andrew Morton
2004-11-23 15:37 ` Phil Dier
2004-11-23 17:02 ` Jakob Oestergaard
2004-11-23 18:29 ` Phil Dier
2004-11-23 22:39 ` Christoph Hellwig
2004-11-23 22:56 ` Jakob Oestergaard
2004-11-23 23:12 ` Christoph Hellwig
2004-11-30 17:37 ` Phil Dier
2004-11-24 15:45 ` Phil Dier
2004-11-24 16:56 ` Christoph Hellwig
2004-11-24 23:12 ` Andrew Morton
2004-11-25 0:48 ` Phil Dier
2004-11-28 11:29 ` David Greaves
2004-11-28 18:27 ` Andrew Morton
2004-12-08 9:03 ` David Greaves
2004-12-08 9:15 ` Andrew Morton
2004-12-09 3:50 ` Nigel Cunningham
2004-11-24 23:12 ` Neil Brown
2004-11-24 23:50 ` Andrew Morton
2004-11-25 0:14 ` Neil Brown
2004-11-25 1:05 ` Andrew Morton
2004-11-25 6:57 ` Jens Axboe
2004-11-25 7:08 ` Andrew Morton [this message]
2004-11-25 7:11 ` Jens Axboe
2004-11-23 20:48 Joerg Sommrey
2004-11-24 9:28 Anders Saaby
[not found] <33rTj-1VZ-13@gated-at.bofh.it>
[not found] ` <33wJq-633-25@gated-at.bofh.it>
[not found] ` <34fwL-P1-21@gated-at.bofh.it>
[not found] ` <34fGp-V2-9@gated-at.bofh.it>
[not found] ` <34fGp-V2-7@gated-at.bofh.it>
[not found] ` <34lVr-5WH-1@gated-at.bofh.it>
[not found] ` <34m5a-61Z-9@gated-at.bofh.it>
2004-11-25 11:07 ` Andi Kleen
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=20041124230838.4d639c6d.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=axboe@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@cse.unsw.edu.au \
--cc=phil@dier.us \
/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®