Re: [Bug? Report] kref problem

Greg KH
2006-03-16T16:47:23Z

On Thu, Mar 16, 2006 at 02:41:19PM +0300, Artem B. Bityutskiy wrote:
> Hello Greg,
>
> I've hit on a kref problem Please, glance at the attached test module.
>
> The idea of the test is to create 2 kobjects (a and b), create dir A
> with kobject A, and dir B with kobject B, so that A is B's parent. E.g.,
> we'll have /sys/A/B.
>
> I see the following output of the test:
>
> a inited, kref 1
> b inited, kref 1
> dir A created, A kref 1, B kref 1
> dir B created, A kref 1, B kref 1
> b_release
> a_release
> kobj B put, A kref 0, B kref 0
> kobj A put, A kref -1, B kref 0
>
>
> So what I don't like is this "A kref -1". Why when I remove directory B,
> kobj a is released? For me it looks like a bug.

Sample code please?

Also, creating sysfs directories does not change the reference count on
kobjects, they are two separate things.

thanks,

greg k-h