From 3e15d2383b73ce3b287805f2ed8e3e5e288d15f0ba1d1d6cfa7ae26c3d8776f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= Date: Tue, 9 Oct 2018 06:37:10 +0000 Subject: [PATCH] Accepting request 640693 from home:StefanBruens:branches:systemsmanagement - Fix occasional crash when freed pages landed on the dirty list twice * Add 0001-ITS-8756-remove-loose-pg-from-dirty-list-in-freelist.patch OBS-URL: https://build.opensuse.org/request/show/640693 OBS-URL: https://build.opensuse.org/package/show/systemsmanagement/lmdb?expand=0&rev=29 --- ...loose-pg-from-dirty-list-in-freelist.patch | 59 +++++++++++++++++++ lmdb.changes | 6 ++ lmdb.spec | 5 +- 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 0001-ITS-8756-remove-loose-pg-from-dirty-list-in-freelist.patch diff --git a/0001-ITS-8756-remove-loose-pg-from-dirty-list-in-freelist.patch b/0001-ITS-8756-remove-loose-pg-from-dirty-list-in-freelist.patch new file mode 100644 index 0000000..14b5d59 --- /dev/null +++ b/0001-ITS-8756-remove-loose-pg-from-dirty-list-in-freelist.patch @@ -0,0 +1,59 @@ +From 5e51a5b9f41880cac3d1bf621630de80e15de224 Mon Sep 17 00:00:00 2001 +From: Howard Chu +Date: Fri, 22 Jun 2018 16:30:13 +0100 +Subject: [PATCH] ITS#8756 remove loose pg from dirty list in freelist_save + +--- + libraries/liblmdb/mdb.c | 33 ++++++++++++++++++++++++++++++++- + 1 file changed, 32 insertions(+), 1 deletion(-) + +diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c +index d9e7c5e1e..77c6ecd89 100644 +--- a/libraries/liblmdb/mdb.c ++++ b/libraries/liblmdb/mdb.c +@@ -3094,10 +3094,41 @@ mdb_freelist_save(MDB_txn *txn) + * we may be unable to return them to me_pghead. + */ + MDB_page *mp = txn->mt_loose_pgs; ++ MDB_ID2 *dl = txn->mt_u.dirty_list; ++ unsigned x; + if ((rc = mdb_midl_need(&txn->mt_free_pgs, txn->mt_loose_count)) != 0) + return rc; +- for (; mp; mp = NEXT_LOOSE_PAGE(mp)) ++ for (; mp; mp = NEXT_LOOSE_PAGE(mp)) { + mdb_midl_xappend(txn->mt_free_pgs, mp->mp_pgno); ++ /* must also remove from dirty list */ ++ if (txn->mt_flags & MDB_TXN_WRITEMAP) { ++ for (x=1; x<=dl[0].mid; x++) ++ if (dl[x].mid == mp->mp_pgno) ++ break; ++ mdb_tassert(txn, x <= dl[0].mid); ++ } else { ++ x = mdb_mid2l_search(dl, mp->mp_pgno); ++ mdb_tassert(txn, dl[x].mid == mp->mp_pgno); ++ } ++ dl[x].mptr = NULL; ++ mdb_dpage_free(env, mp); ++ } ++ { ++ /* squash freed slots out of the dirty list */ ++ unsigned y; ++ for (y=1; dl[y].mptr && y <= dl[0].mid; y++); ++ if (y <= dl[0].mid) { ++ for(x=y, y++;;) { ++ while (!dl[y].mptr && y <= dl[0].mid) y++; ++ if (y > dl[0].mid) break; ++ dl[x++] = dl[y++]; ++ } ++ dl[0].mid = x-1; ++ } else { ++ /* all slots freed */ ++ dl[0].mid = 0; ++ } ++ } + txn->mt_loose_pgs = NULL; + txn->mt_loose_count = 0; + } +-- +2.19.0 + diff --git a/lmdb.changes b/lmdb.changes index 32f9fe4..4273c0a 100644 --- a/lmdb.changes +++ b/lmdb.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sat Oct 6 14:18:37 UTC 2018 - Stefan BrĂ¼ns + +- Fix occasional crash when freed pages landed on the dirty list twice + * Add 0001-ITS-8756-remove-loose-pg-from-dirty-list-in-freelist.patch + ------------------------------------------------------------------- Sun Jun 3 19:23:50 UTC 2018 - stefan.bruens@rwth-aachen.de diff --git a/lmdb.spec b/lmdb.spec index be59327..9a4c0a6 100644 --- a/lmdb.spec +++ b/lmdb.spec @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -35,6 +35,8 @@ Patch1: 0001-Add-extra-tools-and-CFEngine-modifications-for-LMDB.patch Patch2: liblmdb-implicit-decl.patch # PATCH-FIX-OPENSUSE - Build and link to shared library Patch3: Makefile-build-use-shared-lib.patch +# PATCH-FIX-UPSTREAM - Fix crash due to failed assertion, freed pages ended up on the dirty page list twice +Patch4: 0001-ITS-8756-remove-loose-pg-from-dirty-list-in-freelist.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?rhel_version} == 700 @@ -87,6 +89,7 @@ the liblmdb library. %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 %build cd libraries/liblmdb