[PATCH v2 05/23] nscd: Use a real read-write lock for the client mapping

Carlos O'Donell carlos@redhat.com
Mon Mar 23 16:21:30 GMT 2026


On 3/23/26 12:01 PM, Florian Weimer wrote:
> * Carlos O'Donell:
> 
>> On 3/20/26 4:41 PM, Florian Weimer wrote:
>>> The old code had half of an implementation of a rwlock, but did
>>> not have code to wait in case the mapping was used by another
>>> thread, so it performed busy waiting in some cases.  Switch
>>> to a proper rwlock instead.
>>
>> ...
>>
>>> -struct locked_map_ptr
>>> -{
>>> -  int lock;
>>> -  struct mapped_database *mapped;
>>> +  /* Use of the mapping must acquire a read lock.  If the mapping is
>>> +     changed, acquire a write lock.  */
>>> +  __libc_rwlock_define (, lock);
>>
>> Does this work when you have a 64-bit nscd with both 64-bit and 32-bit clients?
> 
> This is a libc-internal data structure, not part of the shared mapping.
> See the “*” on the deleted line.  That changed between different word
> sizes before.

Perfect. Thanks. I'll keep reviewing and probably send out quick questions
as I think of them while reviewing the series.

-- 
Cheers,
Carlos.



More information about the Libc-alpha mailing list