Re: [PATCH 0/3] refcounting improvements in sysfs.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Neil Brown
Date: Sunday, March 28, 2010 - 10:10 pm

On Fri, 26 Mar 2010 15:32:51 +0900
Tejun Heo <teheo@suse.de> wrote:


Hi Tejun,

this strikes me as really valuable experience that it would be great to
share.   While I generally like kref and see value in at least some of
kobject I don't for a moment suppose they are perfect.  Fixing them requires
a good understanding of the problems they cause.  If you have that knowledge,
it would be a great resource for anyone wanting to 'fix' kobject.
Are you interested in writing anything (more) up at all???



This would argue that having a return value from kobject_get violates Rusty's
law that interfaces should be hard to misuse.
We could probably change that - it is only used 19 times in the current
kernel.
It probably doesn't help that Documentation/kobject.txt includes the text:

    A successful call to kobject_get() will increment the kobject's reference
    counter and return the pointer to the kobject.

which seems to suggest that an unsuccessful call is possible.



I'm not immediately convinced by this, though maybe I haven't seen enough
examples yet.

The deadlocks that I have come across would not have been any more obvious in
either of the above - they were caused because sysfs_remove deadlocks when
called from inside a sysfs attribute action...

Also, while this re-write is possible for kref uses it isn't really possible
in kobject as the 'final_put' function must be included in the ktype (though
maybe you don't like that either).

What would be really helpful here is a survey of what sorts of things are
actually done in final_put functions so would could create some guidelines
about how to write the release functions.

Thanks,
NeilBrown



--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 2/3] sysfs: make s_count a kref, NeilBrown, (Tue Mar 23, 8:20 pm)
[PATCH 0/3] refcounting improvements in sysfs., NeilBrown, (Tue Mar 23, 8:20 pm)
Re: [PATCH 0/3] refcounting improvements in sysfs., Eric W. Biederman, (Thu Mar 25, 8:10 pm)
Re: [PATCH 0/3] refcounting improvements in sysfs., Neil Brown, (Thu Mar 25, 8:28 pm)
Re: [PATCH 1/3] sysfs: simplify handling for s_active refcount, Eric W. Biederman, (Thu Mar 25, 9:24 pm)
Re: [PATCH 2/3] sysfs: make s_count a kref, Eric W. Biederman, (Thu Mar 25, 9:29 pm)
Re: [PATCH 0/3] refcounting improvements in sysfs., Tejun Heo, (Thu Mar 25, 9:49 pm)
Re: [PATCH 3/3] kref: create karef and use for sysfs_diren ..., Eric W. Biederman, (Thu Mar 25, 9:50 pm)
Re: [PATCH 0/3] refcounting improvements in sysfs., Tejun Heo, (Thu Mar 25, 10:10 pm)
Re: [PATCH 0/3] refcounting improvements in sysfs., Neil Brown, (Thu Mar 25, 11:02 pm)
Re: [PATCH 0/3] refcounting improvements in sysfs., Tejun Heo, (Thu Mar 25, 11:32 pm)
Re: [PATCH 1/3] sysfs: simplify handling for s_active refcount, Eric W. Biederman, (Fri Mar 26, 12:53 am)
Re: [PATCH 0/3] refcounting improvements in sysfs., Neil Brown, (Sun Mar 28, 10:10 pm)
Re: [PATCH 0/3] refcounting improvements in sysfs., Tejun Heo, (Tue Mar 30, 8:20 pm)