Re: [PATCH] driver core: remove unneeded klist methods

From: James Bottomley
Date: Fri Jan 20 2006 - 19:48:38 EST


On Fri, 2006-01-20 at 11:39 -0500, Alan Stern wrote:
> This patch (as641) removes unneeded klist methods from the driver core and
> changes a klist_del call to klist_remove in device_del.
>
> The _get and _put methods have no effect, because the klist nodes are
> deleted by calling klist_remove, which waits until they are unreferenced
> by any klist iterators. Furthermore, the _puts cause problems because
> they occur while the iterator is holding a spinlock.

Could you just elaborate on the actual problem that you're trying to
solve here?

Iterators of volatile lists are ipso facto just "best guess", so moving
the location of the iterator piece is OK. However, your assumption that
only the routine called by the iterator is always going to do the final
put on the object is fundamentally flawed. The list is volatile because
references to the object are being acquired and released all the time.
Additionally, the list nodes are embedded in the object, so by removing
the object get and put calls, you remove the ability for the object
refcounting to see the fact that the list is using the object. This
will lead to the situation where the object could be freed while the
iterator is acting on it. You cannot remove the object get/put calls
from the klist references otherwise the list refcounting will be totally
divorced from the object refcounting.

James


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/