Re: [linux-usb-devel] [PATCH] back out sysfs reference count change

Benjamin Herrenschmidt
2004-03-31T02:12:25Z

On Wed, 2004-03-31 at 09:55, Greg KH wrote:
> Hi,
>
> The patch below backs out Maneesh's sysfs patch that was recently added
> to the kernel. In its defense, the original patch did solve some fixes
> that could be duplicated on SMP machines, but the side affect of the
> patch caused lots of problems. Basically it caused kobjects to get
> their references incremented when files that are not present in the
> kobject are asked for (udev can easily trigger this when it looks for
> files call "dev" in directories that do not have that file). This can
> cause easy oopses when the VFS later ages out those old dentries and the
> kobject has its reference finally released (usually after the module
> that the kobject lived in was removed.)

I think that the bug in the first place is to have an existing
kobject that didn't bump the module ref count.

If a kobject exists that have a pointer to the module code (the
release function), it _MUST_ have bumped the module ref count,
that's the whole point of the module reference count.

If rmmod blocks forever because that kobject has a stale reference,
that's a different problem, but khubd should not be involved in
that process and should definitely not be blocked and not wait for
the kobject to go away.

Ben.