From: Andrew Morton <akpm@linux-foundation.org>
To: mangoo@wpkg.org, linux-raid@vger.kernel.org,
linux-kernel@vger.kernel.org, balajirrao@gmail.com,
Neil Brown <neilb@suse.de>
Subject: Re: sysfs Kernel BUG when RAID bitmap file has IO errors
Date: Wed, 12 Mar 2008 15:43:58 -0700 [thread overview]
Message-ID: <20080312154358.e9d16668.akpm@linux-foundation.org> (raw)
In-Reply-To: <20080312153618.b3e0612a.akpm@linux-foundation.org>
On Wed, 12 Mar 2008 15:36:18 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:
> I assume this is the BUG_ON(count >= (ssize_t)PAGE_SIZE) in
> fill_read_buffer().
>
> This was reported recently and we prepared a debug patch but the
> reporter was unable to trigger the bug again.
>
> Please add the below and retest?
err, don't bother.
rdev->sb_size = MD_SB_BYTES;
...
#define MD_SB_BYTES 4096
...
and
rdev->sb_size = le32_to_cpu(sb->max_dev) * 2 + 256;
bmask = queue_hardsect_size(rdev->bdev->bd_disk->queue)-1;
if (rdev->sb_size & bmask)
rdev->sb_size = (rdev->sb_size | bmask) + 1;
I'm assuming that either the above sequence of code never ran at all, or it
produced sb_size >= PAGE_SIZE.
then this:
static ssize_t
super_show(mdk_rdev_t *rdev, char *page)
{
if (rdev->sb_loaded && rdev->sb_size) {
memcpy(page, page_address(rdev->sb_page), rdev->sb_size);
return rdev->sb_size;
} else
return 0;
}
returns something >= PAGE_SIZE then this:
static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer)
{
struct sysfs_dirent *attr_sd = dentry->d_fsdata;
struct kobject *kobj = attr_sd->s_parent->s_dir.kobj;
struct sysfs_ops * ops = buffer->ops;
int ret = 0;
ssize_t count;
if (!buffer->page)
buffer->page = (char *) get_zeroed_page(GFP_KERNEL);
if (!buffer->page)
return -ENOMEM;
/* need attr_sd for attr and ops, its parent for kobj */
if (!sysfs_get_active_two(attr_sd))
return -ENODEV;
buffer->event = atomic_read(&attr_sd->s_attr.open->event);
count = ops->show(kobj, attr_sd->s_attr.attr, buffer->page);
sysfs_put_active_two(attr_sd);
/*
* The code works fine with PAGE_SIZE return but it's likely to
* indicate truncated result or overflow in normal use cases.
*/
BUG_ON(count >= (ssize_t)PAGE_SIZE);
declares game over.
Neil, pls fix?
next prev parent reply other threads:[~2008-03-12 22:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-12 9:40 sysfs Kernel BUG when RAID bitmap file has IO errors Tomasz Chmielewski
2008-03-12 9:51 ` Tomasz Chmielewski
2008-03-12 9:51 ` Tomasz Chmielewski
2008-03-12 22:36 ` Andrew Morton
2008-03-12 22:43 ` Andrew Morton [this message]
2008-03-14 4:34 ` Neil Brown
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=20080312154358.e9d16668.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=balajirrao@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=mangoo@wpkg.org \
--cc=neilb@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.