From: Greg KH <gregkh@suse.de>
To: David Miller <davem@davemloft.net>
Cc: linux-kernel@vger.kernel.org, kay.sievers@vrfy.org
Subject: Re: partition sysfs OOPS in current GIT
Date: Wed, 6 Feb 2008 23:18:07 -0800 [thread overview]
Message-ID: <20080207071807.GA13866@suse.de> (raw)
In-Reply-To: <20080206.231144.174648341.davem@davemloft.net>
On Wed, Feb 06, 2008 at 11:11:44PM -0800, David Miller wrote:
> From: Greg KH <gregkh@suse.de>
> Date: Wed, 6 Feb 2008 23:00:44 -0800
>
> > On Wed, Feb 06, 2008 at 10:39:44PM -0800, David Miller wrote:
> > > From: Greg KH <gregkh@suse.de>
> > > Date: Wed, 6 Feb 2008 22:42:10 -0800
> > >
> > > > On Wed, Feb 06, 2008 at 10:05:44PM -0800, David Miller wrote:
> > > > > I found the problem, it's the "whole_disk" partition attribute.
> > > >
> > > > I don't understand that code at all, on 2.6.24, what does reading that
> > > > file give you? At first glance, I don't see how that file would spit
> > > > out anything and not give you the same kind of oops.
> > > >
> > > > you are in a maze of kobject pointers, all alike...
> > >
> > > It's supposed to just exist, and be an empty zero length file.
> > > That's why it's given no ->show method pointer.
> > >
> > > It's existence just means that the partition is a "whole disk"
> > > partition type.
> >
> > Can you try this patch to see if it solves the oops, and that the file
> > is still there and works properly?
>
> It doesn't crash, but the file returns -EIO instead of zero when read.
How about this attempt?
thanks for your patience,
greg "Kay owes me a beer" k-h
---
fs/partitions/check.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -319,6 +319,14 @@ void delete_partition(struct gendisk *di
put_device(&p->dev);
}
+static ssize_t whole_disk_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return 0;
+}
+static DEVICE_ATTR(whole_disk, S_IRUSR | S_IRGRP | S_IROTH,
+ whole_disk_show, NULL);
+
void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len, int flags)
{
struct hd_struct *p;
@@ -352,13 +360,8 @@ void add_partition(struct gendisk *disk,
device_add(&p->dev);
partition_sysfs_add_subdir(p);
p->dev.uevent_suppress = 0;
- if (flags & ADDPART_FLAG_WHOLEDISK) {
- static struct attribute addpartattr = {
- .name = "whole_disk",
- .mode = S_IRUSR | S_IRGRP | S_IROTH,
- };
- err = sysfs_create_file(&p->dev.kobj, &addpartattr);
- }
+ if (flags & ADDPART_FLAG_WHOLEDISK)
+ err = device_create_file(&p->dev, &dev_attr_whole_disk);
/* suppress uevent if the disk supresses it */
if (!disk->dev.uevent_suppress)
next prev parent reply other threads:[~2008-02-07 7:20 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-06 23:26 partition sysfs OOPS in current GIT David Miller
2008-02-06 23:31 ` Greg KH
2008-02-06 23:37 ` David Miller
2008-02-06 23:48 ` David Miller
2008-02-06 23:59 ` Greg KH
2008-02-07 0:02 ` David Miller
2008-02-07 0:09 ` Greg KH
2008-02-07 0:29 ` David Miller
2008-02-07 4:06 ` David Miller
2008-02-07 5:47 ` Greg KH
2008-02-07 6:05 ` David Miller
2008-02-07 6:38 ` Greg KH
2008-02-07 6:38 ` David Miller
2008-02-07 6:42 ` Greg KH
2008-02-07 6:39 ` David Miller
2008-02-07 6:58 ` Greg KH
2008-02-07 7:00 ` Greg KH
2008-02-07 7:11 ` David Miller
2008-02-07 7:18 ` Greg KH [this message]
2008-02-07 7:33 ` David Miller
2008-02-07 7:43 ` Greg KH
2008-02-07 7:20 ` Greg KH
2008-02-07 7:24 ` David Miller
2008-02-07 7:42 ` Greg KH
2008-02-07 6:44 ` Greg KH
2008-02-07 6:42 ` David Miller
2008-02-06 23:57 ` Andrew Morton
2008-02-07 0:07 ` Greg KH
2008-02-06 23:42 ` Oops figures Jan Engelhardt
2008-02-06 23:42 ` Jan Engelhardt
2008-02-06 23:47 ` David Miller
2008-02-06 23:47 ` David Miller
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=20080207071807.GA13866@suse.de \
--to=gregkh@suse.de \
--cc=davem@davemloft.net \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@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 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.