On Sat, Jun 30, 2018 at 8:42 PM Benjamin Herrenschmidt
<[email protected]> wrote:
>
> But what if something *else* still holds a reference to the kobject ?
> It could be anything really... t
But that's fine. Then the object will continue to exist, and the sysfs
file will continue to exist, and you won't get a new glue directory.
In fact, what you describe is a problem with *your* patch, exactly
because you introduce another counter that is *not* the reference
count, and now you have the problem with "old directory kobject is
still live, but I removed the sysfs part, and now I'm creating a new
object with the same name".
Hmm?
> It is and there's a WARN_ON about it inside kobject_get(). I don't
> think anybody argues against that, you are absolutely right.
No. That the zero kobject_get() will not result in a warning. It just
does a kref_get(), no warnings anywhere.
Yes, there is a kobject_get() warning, but that's about an
_uninitialized_ kobject, not a already released one! You will get no
warning that I can see from the "oh, you just got a stale one".
Linus