Subject: Re: linux-next: Tree for August 14 (sysfs/acpi errors)

From: Kay Sievers <[email-masked]>
Date: Mon, 18 Aug 2008 12:58:44 +0200

On Mon, 2008-08-18 at 19:43 +1000, Rusty Russell wrote:
> On Monday 18 August 2008 13:48:51 Greg KH wrote:
> > On Sun, Aug 17, 2008 at 05:53:07AM +0200, Andi Kleen wrote:
> > > Greg KH <[email-masked]> writes:
> > > >> No!
> > > >
> > > > What you are doing here is wrong, trying to create two files with the
> > > > same name.  You just should not be doing that at all, it's that simple.
> > > > Fix the broken code/link order, don't paper it over in the sysfs layer.
> > >
> > > Sorry, but relying on link order for anything is a mistake. It is subtle
> > > and fragile and just means it'll eventually break again because it's
> > > near impossible to properly maintain.
> >
> > We rely on link order for all sorts of things, this isn't new at all.
> 
> Sure, but this code should be rewritten to check if the directory exists,
> rather assuming it based on "previous prefix was the same".
> 
> It's relying on a horribly undocumented assumption, and it broke.
> 
> We need to change kernel_param_sysfs_setup() to do something
> like "kobject_find(module_kset, name)" and only allocate a new mk if that
> fails.

kobj = kset_find_obj(module_kset, name) should return an existing object
with that name (and take a reference on it, which needs to be dropped).

Kay