Matthew Ahrens wrote:
> Neil Perrin wrote:
>>
>> Ricardo M. Correia wrote:
>>> Ricardo M. Correia wrote:
>>>> boolean_t need_lock = !RW_LOCK_HELD(&dp->dp_config_rwlock);
>>>>
>>>> if (need_lock)
>>>>         rw_enter(&dp->dp_config_rwlock, RW_READER);
>>>>
>>> Maybe I posted to soon.
>>> Am I right that this specific code (in dsl_dataset.c) would work 
>>> correctly if RW_LOCK_HELD() returned true if *another* thread is 
>>> holding the lock as a reader?
>>
>> Yes this looks like a bug to me as well.
> 
> This is not a bug, it is the designed behavior.  To tell if this 
> specific thread is holding the lock for reader would require a 
> performance hit (eg, see rrwlock.c behavior when rr_writer_wanted is set).
> 
> --matt

- I'm confused then. The dp_config_rwlock lock must be held as it's
asserted in dsl_prop_get_ds_locked() However, the lock can be
dropped immediately after the test dsl_dataset_open_obj() as it only
checks if anyone is holding it - not just the caller. Am I missing something?

Neil.


Reply via email to