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

Andrew Morton
2004-03-31T02:19:43Z

Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>
> 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.

Amen, Brother Ben. I think the hangup here is that lsmod would show module
refcounts of 2,417. So for cosmetic reasons, the kobject should take a ref
against an intermediate kref, which has a single ref on the module.

But it looks like that's all in a faraway perfect world, and Greg is going
to fix stuff up somehow ;)