Ignore updates from non-tracked subtrees during modify/modrdn/update to avoid deadlocks with retro changelog

This commit is contained in:
Alexander Bokovoy 2023-10-10 11:25:43 +03:00 committed by root
parent 29d38010ad
commit 0c724e7262
3 changed files with 111 additions and 1 deletions

1
.slapi-nis.metadata Normal file
View File

@ -0,0 +1 @@
e5a84cf93b13b174c6d865de2f735cbfbc950917 slapi-nis-0.60.0.tar.gz

102
slapi-nis-RHEL-5134.patch Normal file
View File

@ -0,0 +1,102 @@
From ee94788e63d9f35daca7c0d1e80a488f738a9c52 Mon Sep 17 00:00:00 2001
From: Thierry Bordaz <tbordaz@redhat.com>
Date: Fri, 1 Sep 2023 11:02:08 +0200
Subject: [PATCH 1/2] BZ 2124214 - schema compat plugin deadlock on delete post
op
Bug description:
backends locks (SC map and retroCL) are acquired in
the opposite order
(https://bugzilla.redhat.com/show_bug.cgi?id=2124214#c17)
Fix description:
Credits of the fix are to Pierre Rogier who found
a reproducible testcase, did the fix and verified it.
In specific condition of retroCL trimming the DEL
callback of the SC should check if the backend should
be ignored
relates: 2124214
---
src/back-shr.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/back-shr.c b/src/back-shr.c
index ce2b1f3..1792bef 100644
--- a/src/back-shr.c
+++ b/src/back-shr.c
@@ -2811,6 +2811,18 @@ backend_shr_delete_cb(Slapi_PBlock *pb)
if (wrap_get_call_level() > 0) {
return 0;
}
+ /* especially important to test if we want to prevent frequent
+ * deadlocks when backends are accesses in opposite order.
+ * i.e. "regular" update on domain map+retroCL and retroCL trimming
+ * retroCL+domain map
+ */
+ if (backend_shr_write_ignore(pb)) {
+#if DEBUG_MAP_LOCK
+ slapi_log_error(SLAPI_LOG_FATAL, "schema-compat",
+ "backend_shr_delete_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);
--
2.41.0
From 61fcf534c3da767788e27641f3ebfe4d6a6c0b25 Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <abokovoy@redhat.com>
Date: Mon, 9 Oct 2023 13:53:28 +0300
Subject: [PATCH 2/2] Add more ignores to modrdn and modify cases
BZ 2124214 - schema compat plugin deadlock on delete post op
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
---
src/back-shr.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/back-shr.c b/src/back-shr.c
index 1792bef..4cbc39b 100644
--- a/src/back-shr.c
+++ b/src/back-shr.c
@@ -2463,6 +2463,15 @@ backend_shr_modify_cb(Slapi_PBlock *pb)
/* No data yet, ignore */
return 0;
}
+
+ if (backend_shr_write_ignore(pb)) {
+#if DEBUG_MAP_LOCK
+ slapi_log_error(SLAPI_LOG_FATAL, "schema-compat",
+ "backend_shr_modify_cb: (%p) operation is not impacting schema compat\n", PR_MyThreadId(), 1);
+#endif
+ return 0;
+ }
+
slapi_pblock_get(pb, SLAPI_MODIFY_TARGET, &dn);
slapi_pblock_get(pb, SLAPI_MODIFY_MODS, &cbdata.mods);
slapi_pblock_get(pb, SLAPI_ENTRY_PRE_OP, &cbdata.e_pre);
@@ -2669,6 +2678,15 @@ backend_shr_modrdn_cb(Slapi_PBlock *pb)
/* No data yet, ignore */
return 0;
}
+
+ if (backend_shr_write_ignore(pb)) {
+#if DEBUG_MAP_LOCK
+ slapi_log_error(SLAPI_LOG_FATAL, "schema-compat",
+ "backend_shr_modrdn_cb: (%p) operation is not impacting schema compat\n", PR_MyThreadId(), 1);
+#endif
+ return 0;
+ }
+
slapi_pblock_get(pb, SLAPI_ENTRY_PRE_OP, &cbdata.e_pre);
slapi_pblock_get(pb, SLAPI_ENTRY_POST_OP, &cbdata.e_post);
--
2.41.0

View File

@ -11,7 +11,7 @@
Name: slapi-nis
Version: 0.60.0
Release: 3%{?dist}
Release: 4%{?dist}
Summary: NIS Server and Schema Compatibility plugins for Directory Server
Group: System Environment/Daemons
License: GPLv3
@ -19,6 +19,7 @@ URL: http://pagure.io/slapi-nis/
Source0: https://releases.pagure.org/slapi-nis/slapi-nis-%{version}.tar.gz
Source1: https://releases.pagure.org/slapi-nis/slapi-nis-%{version}.tar.gz.asc
Patch0: slapi-nis-bz2183469.patch
Patch1: slapi-nis-RHEL-5134.patch
BuildRequires: make
BuildRequires: autoconf
@ -59,6 +60,7 @@ for attributes from multiple entries in the tree.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%build
autoconf --force
@ -87,6 +89,11 @@ make check
%{_sbindir}/nisserver-plugin-defs
%changelog
* Tue Oct 10 2023 Alexander Bokovoy <abokovoy@redhat.com> - 0.60.0-4
- Ignore updates from non-tracked subtrees during modify/modrdn/update
to avoid deadlocks with retro changelog
- Resolves: RHEL-5134
* Mon Apr 24 2023 Alexander Bokovoy <abokovoy@redhat.com> - 0.60.0-3
- Also handle base searches within the compat tree
- Related: rhbz#2183469