From c7938c444f1c88e6f12ab9306fad558a0c25490e Mon Sep 17 00:00:00 2001 From: Thierry Bordaz Date: Mar 12 2020 16:55:56 +0000 Subject: Bug 1768156: ERR - schemacompat - map rdlock: old way MAP_MONITOR_DISABLED Bug Description: With 1435663 slapi-nis (schema-compat / NIS) uses a new locking mechanisme. This locking mechanism is initialized with schema-compat init function, so if it is not enabled and NIS is enabled the new mechanism is not initialized. NIS plugin then fallback to old locking mechanism. The problem is that it continuously logs an alarming message. Fix Description: If slapi-nis fallback to old locking mechanism, it logs a single information message. https://bugzilla.redhat.com/show_bug.cgi?id=1768156 Reviewed by: Alexander Bokovoy Platforms tested: F31 Flag Day: no Doc impact: no --- diff --git a/src/map.c b/src/map.c index 3be60b4..f55746d 100644 --- a/src/map.c +++ b/src/map.c @@ -1254,11 +1254,15 @@ map_rdlock(void) int lock_status; int lock_count; int rc = 0; + static PRInt32 warn_done = 0; if (rw_monitor_enabled() == MAP_MONITOR_DISABLED) { /* This is not initialized used the old way */ - slapi_log_error(SLAPI_LOG_FATAL, "schemacompat", - "map rdlock: old way MAP_MONITOR_DISABLED\n"); + if (warn_done == 0) { + slapi_log_error(SLAPI_LOG_INFO, "schema-compat", + " using former locking strategy\n"); + PR_AtomicSet(&warn_done, 1); + } return wrap_rwlock_rdlock(map_data.lock); } @@ -1330,11 +1334,15 @@ map_wrlock(void) int lock_status; int lock_count; int rc = 0; + static PRInt32 warn_done = 0; if (rw_monitor_enabled() == MAP_MONITOR_DISABLED) { /* This is not initialized used the old way */ - slapi_log_error(SLAPI_LOG_FATAL, "schema-compat", - "map wrlock: old way MAP_MONITOR_DISABLED\n"); + if (warn_done == 0) { + slapi_log_error(SLAPI_LOG_INFO, "schema-compat", + " using former locking strategy\n"); + PR_AtomicSet(&warn_done, 1); + } return wrap_rwlock_wrlock(map_data.lock); } @@ -1431,11 +1439,15 @@ map_unlock(void) int lock_status; int lock_count; int rc = 0; + static PRInt32 warn_done = 0; if (rw_monitor_enabled() == MAP_MONITOR_DISABLED) { /* This is not initialized used the old way */ - slapi_log_error(SLAPI_LOG_FATAL, "schema-compat", - "map_unlock: old way MAP_MONITOR_DISABLED\n"); + if (warn_done == 0) { + slapi_log_error(SLAPI_LOG_INFO, "schema-compat", + " using former locking strategy\n"); + PR_AtomicSet(&warn_done, 1); + } return wrap_rwlock_unlock(map_data.lock); }