Re: [PATCH v2 2/6] libceph: introduce reference counted string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Mar 23, 2016, at 7:39 PM, Yan, Zheng <zyan@xxxxxxxxxx> wrote:
> 
> 
>> On Mar 23, 2016, at 23:39, Douglas Fuller <dfuller@xxxxxxxxxx> wrote:
>> 
>> 
>>> +#define ceph_try_get_string(x)					\
>>> +({								\
>>> +	struct ceph_string *___str;				\
>>> +	rcu_read_lock();					\
>>> +	___str = rcu_dereference(x);				\
>>> +	if (___str && !kref_get_unless_zero(&___str->kref))	\
>>> +		___str = NULL;					\
>>> +	rcu_read_unlock();					\
>>> +	(___str);						\
>> 
>> Isn’t this an unsafe use of __str? As I understand it, it could be updated after rcu_read_unlock().
> 
> where does it get updated?

By a later RCU update. As I understand it, an rcu_dereference()d pointer is only guaranteed stable inside rcu_read_lock()/rcu_read_unlock().

> 
> Regards
> Yan, Zheng
> 
>> 
>>> +})
>> 
> 

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux