diff options
Diffstat (limited to 'src/sss_client')
-rw-r--r-- | src/sss_client/nss_mc_common.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/sss_client/nss_mc_common.c b/src/sss_client/nss_mc_common.c index 39a00f86..a361f57b 100644 --- a/src/sss_client/nss_mc_common.c +++ b/src/sss_client/nss_mc_common.c @@ -46,6 +46,9 @@ errno_t sss_nss_check_header(struct sss_cli_mc_ctx *ctx) /* retry barrier protected reading max 5 times then give up */ for (count = 5; count > 0; count--) { memcpy(&h, ctx->mmap_base, sizeof(struct sss_mc_header)); + /* we need a barrier here to make sure the compiler does not optimize + * too much and avoids updating the register for the next check */ + __sync_synchronize(); if (MC_VALID_BARRIER(h.b1) && h.b1 == h.b2) { /* record is consistent so we can proceed */ break; |