[lkml]   [2010]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 8/19]: SCST SYSFS interface implementation
On 11/11/2010 02:04 PM, Greg KH wrote:
> On Thu, Nov 11, 2010 at 11:59:28AM +0200, Boaz Harrosh wrote:
>> 4. Exactly Like 3 but without the extra kref member
>> Only x_put() changes and x_kref_release() now receives
>> an x_object
>> int x_put(struct object_x *x)
>> {
>> if (kobject_put(&x->kobj) == 1)
>> // Like above [3] x_kref_release()
>> x_kref_release(x);
>> }
> This is racy, please never do this.

The last ref belongs to the core code. 1 means there are no
more external clients on the object. So it can not race with
decrements. But I guess there is a possibility that it can
race with new increments. If it is the case that new increments
can only come from, say, sysfs access, then if we call the
x_put() == 1 after we are unregistered from sysfs and no new
users are allowed then the counter can only go down and we
have the last reference. No?

Like I said option 4 is delicate it must be done carefully.

> thanks,
> greg k-h


 \ /
  Last update: 2010-11-11 15:09    [W:0.148 / U:1.848 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site