From: Andreas Schwab Date: Thu, 16 Jul 2009 16:57:32 +0000 (-0700) Subject: Use correct release semantic in list update. X-Git-Tag: fedora/glibc-2.10.1-3~4^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cba457a16f1e4cc821ee1e28609f467787674a1f;p=thirdparty%2Fglibc.git Use correct release semantic in list update. nscd uses lockfree lists and we need to ensure the correct release semantics is used when adding to the list. (cherry picked from commit 50158f95525ca59459a90f2a7bc65ceb892a0807) --- diff --git a/ChangeLog b/ChangeLog index 34a5ad631c9..c71653d3f20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,10 @@ 2009-07-16 Ulrich Drepper + + * nscd/cache.c (cache_add): Use atomic_compare_and_exchange_bool_rel + instead of atomic_compare_and_exchange_bool_acq to ensure pointer + is written before the list head update. + Patch by Andreas Schwab . + Jakub Jelinek * malloc/malloc.c [ATOMIC_FASTBINS] (_int_free): Make check for diff --git a/nscd/cache.c b/nscd/cache.c index ab842efc29f..3e6793df2f7 100644 --- a/nscd/cache.c +++ b/nscd/cache.c @@ -179,7 +179,7 @@ cache_add (int type, const void *key, size_t len, struct datahead *packet, /* Put the new entry in the first position. */ do newp->next = table->head->array[hash]; - while (atomic_compare_and_exchange_bool_acq (&table->head->array[hash], + while (atomic_compare_and_exchange_bool_rel (&table->head->array[hash], (ref_t) ((char *) newp - table->data), (ref_t) newp->next));