Re: [PATCH] correct attribute_container list usage

James Bottomley
2005-08-22T22:47:15Z

On Mon, 2005-08-22 at 15:14 -0700, Patrick Mansfield wrote:
> based on whatever was in current 2.6.x git tree a couple weeks ago.]
>
> The klist is (effectively) embedded within the struct device.
>
> The klist_next() gets and puts on the klist object, so when the struct
> device ref (or kref) counts go to zero, we free up the klist independent
> of its ref counts.

Aarg, yet another object lifetime problem.

That somewhat lessens klist's utility, I think. To fix this, the node
kref and the object that embeds it have to be tied together somehow.

One apparent, but rather nasty, solution would be to embed object get
and put into the klist head as functions that take the node, so
klist_next would take the object reference as well as the list kref,
then drop it on klist_release.

James