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

Florian Weimer fweimer@redhat.com
Mon Mar 23 16:01:32 GMT 2026


* 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.

Thanks,
Florian



More information about the Libc-alpha mailing list