[Pkg-freeipa-devel] [Git][freeipa-team/slapi-nis][master] 6 commits: Bug 1768156: ERR - schemacompat - map rdlock: old way MAP_MONITOR_DISABLED

Timo Aaltonen gitlab at salsa.debian.org
Thu Nov 12 11:49:19 GMT 2020



Timo Aaltonen pushed to branch master at FreeIPA packaging / slapi-nis


Commits:
c7938c44 by Thierry Bordaz at 2020-03-12T17:55:56+01:00
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

- - - - -
61c5aca3 by Thierry Bordaz at 2020-03-13T17:36:34+01:00
Bug 1751295: (2) When sync-repl is enabled, slapi-nis can deadlock during retrochanglog trimming

Bug Description:
	Note: same description as original fix for 1751295

	When sync-repl is enabled, it enables retroCL that can lead to the following deadlock scenario.

	Since 1435663, slapi-nis lock is acquired from be_preop to be_postop.
	So during a write operation on domain, retroCL is updated and being a BE_TXN_POST it holds
	slapi-nis lock when it tries to acquire retroCL backend lock.
	If at the same time an operation on the retroCL (like retroCL trimming) acquire retroCL backend
	lock then during its BE_TXN_POST it tries to acquire slapi-nis lock.

	This is a common scenario, when there are updates on several backends, there is a chance
	that two updates are acquiring the backends lock in the opposite order.
	    Here the backends are slapi-nis and retroCL.

Fix Description:
	All slapi-nis plugin callbacks (be_pre/post and betxn_pre/post) should ignore
	updates on suffixes like cn=changelog, cn=config and cn=schema.
	Up to now, only be_pre/post checked if the update can be ignored.

https://bugzilla.redhat.com/show_bug.cgi?id=1751295

- - - - -
3d0be865 by Alexander Bokovoy at 2020-05-04T11:33:22+03:00
Release 0.56.5

- - - - -
d0e7c25f by Timo Aaltonen at 2020-11-12T13:45:01+02:00
Merge branch 'upstream'

- - - - -
3cd7aeb9 by Timo Aaltonen at 2020-11-12T13:45:26+02:00
bump the version

- - - - -
ab0da3c7 by Timo Aaltonen at 2020-11-12T13:48:18+02:00
releasing package slapi-nis version 0.56.5-1

- - - - -


7 changed files:

- configure.ac
- debian/changelog
- slapi-nis.spec
- src/back-sch.c
- src/back-shr.c
- src/back-shr.h
- src/map.c


Changes:

=====================================
configure.ac
=====================================
@@ -1,4 +1,4 @@
-AC_INIT(slapi-nis,0.56.4)
+AC_INIT(slapi-nis,0.56.5)
 AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE(foreign)
 LT_INIT([disable-static])


=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+slapi-nis (0.56.5-1) unstable; urgency=medium
+
+  * New upstream release.
+
+ -- Timo Aaltonen <tjaalton at debian.org>  Thu, 12 Nov 2020 13:48:09 +0200
+
 slapi-nis (0.56.4-1) unstable; urgency=medium
 
   * New upstream release.


=====================================
slapi-nis.spec
=====================================
@@ -10,7 +10,7 @@
 %endif
 
 Name:		slapi-nis
-Version:	0.56.4
+Version:	0.56.5
 Release:	1%{?dist}
 Summary:	NIS Server and Schema Compatibility plugins for Directory Server
 License:	GPLv2
@@ -81,6 +81,11 @@ make check
 %{_sbindir}/nisserver-plugin-defs
 
 %changelog
+* Mon May 04 2020 Alexander Bokovoy <abokovoy at redhat.com> - 0.56.5-1
+- New upstream release
+- Resolves: rhbz#1751295: (2) When sync-repl is enabled, slapi-nis can deadlock during retrochanglog trimming
+- Resolves: rhbz#1768156: ERR - schemacompat - map rdlock: old way MAP_MONITOR_DISABLED
+
 * Fri Feb 07 2020 Alexander Bokovoy <abokovoy at redhat.com> - 0.56.4-1
 - New upstream release
 - Fix build with newer gcc versions


=====================================
src/back-sch.c
=====================================
@@ -2342,36 +2342,16 @@ backend_betxn_pre_write_cb(Slapi_PBlock *pb)
 {
 	struct plugin_state *state;
 
+    if (backend_shr_write_ignore(pb)) {
+#if DEBUG_MAP_LOCK
+        slapi_log_error(SLAPI_LOG_FATAL, "schemacompat",
+                "backend_betxn_pre_write_cb: (%p) operation is not impacting schema compat\n", PR_MyThreadId(), 1);
+#endif
+        return 0;
+    }
 	slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &state);
 	return state->use_be_txns ? backend_write_cb(pb, state) : 0;
 }
-static PRBool
-backend_be_write_ignore(Slapi_PBlock *pb)
-{
-    char *dn = NULL;
-    Slapi_DN *target_sdn = NULL;
-    int check;
-    int i = 0;
-    PRBool ignore = PR_FALSE;
-
-    /* Check if the target DN is a subordinates of
-     * on of the ignored containers
-     */
-    slapi_pblock_get(pb, SLAPI_ORIGINAL_TARGET, &dn);
-    target_sdn = slapi_sdn_new_dn_byval(dn);
-
-    for (i = 0; ignored_containers_sdn[i]; i++) {
-        check  = slapi_sdn_issuffix(target_sdn, ignored_containers_sdn[i]);
-        if (check != 0) {
-            /* This entry is an ignored container */
-            ignore = PR_TRUE;
-            break;
-        }
-    }
-    slapi_sdn_free(&target_sdn);
-    return ignore;
-}
-
 
 static int
 backend_be_pre_write_cb(Slapi_PBlock *pb) {
@@ -2392,7 +2372,7 @@ backend_be_pre_write_cb(Slapi_PBlock *pb) {
     if (rw_monitor_enabled() == MAP_MONITOR_DISABLED) {
         return 0;
     }
-    if (backend_be_write_ignore(pb)) {
+    if (backend_shr_write_ignore(pb)) {
 #if DEBUG_MAP_LOCK
         slapi_log_error(SLAPI_LOG_FATAL, "schemacompat",
                 "backend_be_pre_write_cb: (%p) operation is not impacting schema compat\n", PR_MyThreadId(), 1);
@@ -2484,7 +2464,7 @@ backend_be_post_write_cb(Slapi_PBlock *pb)
     if (rw_monitor_enabled() == MAP_MONITOR_DISABLED) {
         return 0;
     }
-    if (backend_be_write_ignore(pb)) {
+    if (backend_shr_write_ignore(pb)) {
 #if DEBUG_MAP_LOCK
         slapi_log_error(SLAPI_LOG_FATAL, "schemacompat",
                 "backend_be_post_write_cb: (%p) operation was not impacting schema compat\n", PR_MyThreadId(), 1);


=====================================
src/back-shr.c
=====================================
@@ -1894,6 +1894,13 @@ backend_shr_add_cb(Slapi_PBlock *pb)
 	if (wrap_get_call_level() > 0) {
 		return 0;
 	}
+    if (backend_shr_write_ignore(pb)) {
+#if DEBUG_MAP_LOCK
+        slapi_log_error(SLAPI_LOG_FATAL, "schema-compat",
+                "backend_shr_add_cb: (%p) operation is not impacting schema compat\n", PR_MyThreadId(), 1);
+#endif
+        return 0;
+    }
 
 	/* Read parameters from the pblock. */
 	slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &cbdata.state);
@@ -2944,6 +2951,33 @@ init_map_lock(void)
 #endif
 }
 
+PRBool
+backend_shr_write_ignore(Slapi_PBlock *pb)
+{
+    char *dn = NULL;
+    Slapi_DN *target_sdn = NULL;
+    int check;
+    int i = 0;
+    PRBool ignore = PR_FALSE;
+
+    /* Check if the target DN is a subordinates of
+     * on of the ignored containers
+     */
+    slapi_pblock_get(pb, SLAPI_ORIGINAL_TARGET, &dn);
+    target_sdn = slapi_sdn_new_dn_byval(dn);
+
+    for (i = 0; ignored_containers_sdn[i]; i++) {
+        check  = slapi_sdn_issuffix(target_sdn, ignored_containers_sdn[i]);
+        if (check != 0) {
+            /* This entry is an ignored container */
+            ignore = PR_TRUE;
+            break;
+        }
+    }
+    slapi_sdn_free(&target_sdn);
+    return ignore;
+}
+
 int
 rw_monitor_enabled(void)
 {


=====================================
src/back-shr.h
=====================================
@@ -38,6 +38,7 @@ int  get_plugin_monitor_count(void);
 void set_plugin_monitor_count(int lock_count);
 void init_map_lock(void);
 extern Slapi_DN **ignored_containers_sdn;
+PRBool backend_shr_write_ignore(Slapi_PBlock *pb);
 
 
 struct plugin_state;


=====================================
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);
 	}
 



View it on GitLab: https://salsa.debian.org/freeipa-team/slapi-nis/-/compare/275b6de54509a4174444718cb6cb635ea621eb7d...ab0da3c7f0e0fbb3d4c6467f077ae7f22cb2cbc7

-- 
View it on GitLab: https://salsa.debian.org/freeipa-team/slapi-nis/-/compare/275b6de54509a4174444718cb6cb635ea621eb7d...ab0da3c7f0e0fbb3d4c6467f077ae7f22cb2cbc7
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-freeipa-devel/attachments/20201112/0557e3a0/attachment-0001.html>


More information about the Pkg-freeipa-devel mailing list