The Samba-Bugzilla – Attachment 15723 Details for
Bug 14199
LMDB domaindns/forestdns partition corruption with bind9_dlz
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch apples to V4.11
bug-14199-V4-11-01.patch (text/plain), 7.23 KB, created by
Gary Lockyer
on 2020-01-12 19:58:39 UTC
(
hide
)
Description:
Proposed patch apples to V4.11
Filename:
MIME Type:
Creator:
Gary Lockyer
Created:
2020-01-12 19:58:39 UTC
Size:
7.23 KB
patch
obsolete
>From aeb9ae35ab9b8b92baa19c6e685c2c70d0829e72 Mon Sep 17 00:00:00 2001 >From: Gary Lockyer <gary@catalyst.net.nz> >Date: Thu, 19 Dec 2019 16:31:24 +1300 >Subject: [PATCH 1/2] test upgradedns: ensure lmdb lock files linked > >Add tests to check that the '-lock' files for the dns partitions as well as >the data files are linked when running > samba_dnsupgrade --dns-backend=BIND9_DLZ >failure to create these links can cause corruption of the corresponding >data file. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=14199 > >Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >(cherry picked from commit f0cebbe4dd0317e2abfcbe252977383e6f37f3bd) >--- > python/samba/tests/samba_upgradedns_lmdb.py | 75 +++++++++++++++++++++ > selftest/knownfail.d/bug-14199 | 1 + > source4/selftest/tests.py | 2 + > 3 files changed, 78 insertions(+) > create mode 100644 python/samba/tests/samba_upgradedns_lmdb.py > create mode 100644 selftest/knownfail.d/bug-14199 > >diff --git a/python/samba/tests/samba_upgradedns_lmdb.py b/python/samba/tests/samba_upgradedns_lmdb.py >new file mode 100644 >index 00000000000..048993152e2 >--- /dev/null >+++ b/python/samba/tests/samba_upgradedns_lmdb.py >@@ -0,0 +1,75 @@ >+# Unix SMB/CIFS implementation. >+# Copyright (C) Catalyst IT Ltd. 2019 >+# >+# This program is free software; you can redistribute it and/or modify >+# it under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# This program is distributed in the hope that it will be useful, >+# but WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with this program. If not, see <http://www.gnu.org/licenses/>. >+# >+ >+from samba.tests.samba_tool.base import SambaToolCmdTest >+import os >+import shutil >+ >+ >+class UpgradeDnsLmdbTestCase(SambaToolCmdTest): >+ """ >+ Tests for dns upgrade on a lmdb backend >+ """ >+ >+ def setUp(self): >+ super(UpgradeDnsLmdbTestCase, self).setUp() >+ self.tempsambadir = os.path.join(self.tempdir, "samba") >+ os.mkdir(self.tempsambadir) >+ >+ # provision a domain >+ # >+ # returns the tuple (ret, stdout, stderr) >+ def provision(self): >+ command = ( >+ "samba-tool " >+ "domain provision " >+ "--realm=foo.example.com " >+ "--domain=FOO " >+ "--targetdir=%s " >+ "--backend-store=mdb " >+ "--use-ntvfs " % self.tempsambadir) >+ return self.run_command(command) >+ >+ # upgrade a domains dns to BIND9 >+ # >+ # returns the tuple (ret, stdout, stderr) >+ def upgrade_dns(self): >+ command = ( >+ "samba_upgradedns " >+ "--dns-backend=BIND9_DLZ " >+ "--configfile %s/etc/smb.conf" % self.tempsambadir) >+ return self.run_command(command) >+ >+ def tearDown(self): >+ super(UpgradeDnsLmdbTestCase, self).tearDown() >+ shutil.rmtree(self.tempsambadir) >+ >+ def test_lmdb_lock_files_linked_on_upgrade_to_bind9_dlz(self): >+ """ >+ Ensure that links are created for the lock files as well as the >+ data files >+ """ >+ self.provision() >+ self.upgrade_dns() >+ directory = ("%s/bind-dns/dns/sam.ldb.d" % self.tempsambadir) >+ for filename in os.listdir(directory): >+ if filename.endswith(".ldb") and "DNSZONES" in filename: >+ lock_file = ("%s/%s-lock" % (directory, filename)) >+ self.assertTrue( >+ os.path.isfile(lock_file), >+ msg=("Lock file %s/%s-lock for %s, does not exist" % >+ (directory, filename, filename))) >diff --git a/selftest/knownfail.d/bug-14199 b/selftest/knownfail.d/bug-14199 >new file mode 100644 >index 00000000000..f9508910b79 >--- /dev/null >+++ b/selftest/knownfail.d/bug-14199 >@@ -0,0 +1 @@ >+^samba.tests.samba_upgradedns_lmdb.samba.tests.samba_upgradedns_lmdb. >diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py >index 2bc4561b87a..f8fb0074c02 100755 >--- a/source4/selftest/tests.py >+++ b/source4/selftest/tests.py >@@ -700,6 +700,8 @@ planpythontestsuite("none", "samba.tests.samba_tool.help") > planpythontestsuite("ad_dc_default:local", "samba.tests.samba_tool.passwordsettings") > planpythontestsuite("ad_dc:local", "samba.tests.samba_tool.dsacl") > >+planpythontestsuite("none", "samba.tests.samba_upgradedns_lmdb") >+ > # Run these against chgdcpass to share the runtime load > planpythontestsuite("chgdcpass:local", "samba.tests.samba_tool.sites") > planpythontestsuite("chgdcpass:local", "samba.tests.samba_tool.dnscmd") >-- >2.17.1 > > >From 3e3f828119ffe12344f18030feff135e74f4e6b3 Mon Sep 17 00:00:00 2001 >From: Gary Lockyer <gary@catalyst.net.nz> >Date: Thu, 19 Dec 2019 16:31:46 +1300 >Subject: [PATCH 2/2] upgradedns: ensure lmdb lock files linked > >Ensure that the '-lock' files for the dns partitions as well as the data >files are linked when running > samba_dnsupgrade --dns-backend=BIND9_DLZ >failure to create these links can cause corruption of the corresponding >data file. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=14199 > >Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >(cherry picked from commit 0bd479140c18ab79479ced4f25f366744c3afe18) >--- > python/samba/provision/sambadns.py | 10 ++++++++++ > selftest/knownfail.d/bug-14199 | 1 - > 2 files changed, 10 insertions(+), 1 deletion(-) > delete mode 100644 selftest/knownfail.d/bug-14199 > >diff --git a/python/samba/provision/sambadns.py b/python/samba/provision/sambadns.py >index 9b245608c63..239c99ff0b9 100644 >--- a/python/samba/provision/sambadns.py >+++ b/python/samba/provision/sambadns.py >@@ -858,9 +858,19 @@ def create_samdb_copy(samdb, logger, paths, names, domainsid, domainguid): > os.path.join(dns_samldb_dir, metadata_file)) > os.link(os.path.join(private_dir, domainzone_file), > os.path.join(dns_dir, domainzone_file)) >+ if backend_store == "mdb": >+ # If the file is an lmdb data file need to link the >+ # lock file as well >+ os.link(os.path.join(private_dir, domainzone_file + "-lock"), >+ os.path.join(dns_dir, domainzone_file + "-lock")) > if forestzone_file: > os.link(os.path.join(private_dir, forestzone_file), > os.path.join(dns_dir, forestzone_file)) >+ if backend_store == "mdb": >+ # If the database file is an lmdb data file need to link the >+ # lock file as well >+ os.link(os.path.join(private_dir, forestzone_file + "-lock"), >+ os.path.join(dns_dir, forestzone_file + "-lock")) > except OSError: > logger.error( > "Failed to setup database for BIND, AD based DNS cannot be used") >diff --git a/selftest/knownfail.d/bug-14199 b/selftest/knownfail.d/bug-14199 >deleted file mode 100644 >index f9508910b79..00000000000 >--- a/selftest/knownfail.d/bug-14199 >+++ /dev/null >@@ -1 +0,0 @@ >-^samba.tests.samba_upgradedns_lmdb.samba.tests.samba_upgradedns_lmdb. >-- >2.17.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
abartlet
:
review+
gary
:
ci-passed+
Actions:
View
Attachments on
bug 14199
: 15723 |
15724
|
15725