From 72cacb18504947b0321f3fd6d4a1d32a1dc6065a Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jan 25 2018 09:28:29 +0000 Subject: import device-mapper-persistent-data-0.7.0-0.1.rc6.el7_4.1 --- diff --git a/SOURCES/device-mapper-persistent-data-cache_restore-fix-metadata-version-and-clean-shutdown.patch b/SOURCES/device-mapper-persistent-data-cache_restore-fix-metadata-version-and-clean-shutdown.patch new file mode 100644 index 0000000..0387ab9 --- /dev/null +++ b/SOURCES/device-mapper-persistent-data-cache_restore-fix-metadata-version-and-clean-shutdown.patch @@ -0,0 +1,58 @@ + caching/cache_restore.cc | 5 +++-- + caching/restore_emitter.cc | 4 ++-- + caching/restore_emitter.h | 8 +++++++- + 3 files changed, 12 insertions(+), 5 deletions(-) + +diff --git a/caching/cache_restore.cc b/caching/cache_restore.cc +index f62306d..e430c11 100644 +--- a/caching/cache_restore.cc ++++ b/caching/cache_restore.cc +@@ -69,8 +69,9 @@ namespace { + try { + block_manager<>::ptr bm = open_bm(*fs.output, block_manager<>::READ_WRITE); + metadata::ptr md(new metadata(bm, metadata::CREATE)); +- emitter::ptr restorer = create_restore_emitter(md, fs.clean_shutdown, +- fs.metadata_version); ++ emitter::ptr restorer = create_restore_emitter(md, ++ fs.metadata_version, ++ fs.clean_shutdown ? CLEAN_SHUTDOWN : NO_CLEAN_SHUTDOWN); + + check_file_exists(*fs.input); + ifstream in(fs.input->c_str(), ifstream::in); +diff --git a/caching/restore_emitter.cc b/caching/restore_emitter.cc +index 34c5020..b7a573f 100644 +--- a/caching/restore_emitter.cc ++++ b/caching/restore_emitter.cc +@@ -115,9 +115,9 @@ namespace { + + emitter::ptr + caching::create_restore_emitter(metadata::ptr md, unsigned metadata_version, +- bool clean_shutdown) ++ shutdown_type st) + { +- return emitter::ptr(new restorer(md, clean_shutdown, metadata_version)); ++ return emitter::ptr(new restorer(md, st == CLEAN_SHUTDOWN, metadata_version)); + } + + //---------------------------------------------------------------- +diff --git a/caching/restore_emitter.h b/caching/restore_emitter.h +index 5c077af..a1d45d6 100644 +--- a/caching/restore_emitter.h ++++ b/caching/restore_emitter.h +@@ -7,9 +7,15 @@ + //---------------------------------------------------------------- + + namespace caching { ++ ++ enum shutdown_type { ++ CLEAN_SHUTDOWN, ++ NO_CLEAN_SHUTDOWN ++ }; ++ + emitter::ptr create_restore_emitter(metadata::ptr md, + unsigned metadata_version, +- bool clean_shutdown = true); ++ shutdown_type st = CLEAN_SHUTDOWN); + } + + //---------------------------------------------------------------- diff --git a/SOURCES/device-mapper-persistent-data-cache_restore-v2-dirty-bitset-root-not-written.patch b/SOURCES/device-mapper-persistent-data-cache_restore-v2-dirty-bitset-root-not-written.patch new file mode 100644 index 0000000..a6f377d --- /dev/null +++ b/SOURCES/device-mapper-persistent-data-cache_restore-v2-dirty-bitset-root-not-written.patch @@ -0,0 +1,18 @@ + caching/metadata.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/caching/metadata.cc b/caching/metadata.cc +index 7d8bfae..5457533 100644 +--- a/caching/metadata.cc ++++ b/caching/metadata.cc +@@ -124,6 +124,10 @@ void + metadata::commit_mappings() + { + sb_.mapping_root = mappings_->get_root(); ++ if (sb_.version >= 2) { ++ dirty_bits_->flush(); ++ sb_.dirty_root = dirty_bits_->get_root(); ++ } + } + + void diff --git a/SPECS/device-mapper-persistent-data.spec b/SPECS/device-mapper-persistent-data.spec index 04fd305..91d4ef5 100644 --- a/SPECS/device-mapper-persistent-data.spec +++ b/SPECS/device-mapper-persistent-data.spec @@ -8,7 +8,7 @@ Summary: Device-mapper Persistent Data Tools Name: device-mapper-persistent-data Version: 0.7.0 -Release: 0.1.%{pre_release}%{?dist} +Release: 0.1.%{pre_release}%{?dist}.1 License: GPLv3+ Group: System Environment/Base URL: https://github.com/jthornber/thin-provisioning-tools @@ -17,6 +17,10 @@ Source0: https://github.com/jthornber/thin-provisioning-tools/archive/thin-provi Patch0: device-mapper-persistent-data-document-clear-needs-check-flag.patch Patch1: device-mapper-persistent-data-add-era_restore-and-cache_metadata_size-man-pages.patch Patch2: device-mapper-persistent-data-avoid-strip.patch +# Commit: 4da8d19f296a9 +Patch3: device-mapper-persistent-data-cache_restore-fix-metadata-version-and-clean-shutdown.patch +# Commit: e3b7d825696c2 +Patch4: device-mapper-persistent-data-cache_restore-v2-dirty-bitset-root-not-written.patch BuildRequires: autoconf, expat-devel, libaio-devel, libstdc++-devel, boost-devel Requires: expat @@ -34,6 +38,8 @@ snapshot eras %patch0 -p1 -b .clear_needs_check_flag %patch1 -p1 -b .man_pages %patch2 -p1 -b .avoid_strip +%patch3 -p1 -b .fix_flags +%patch4 -p1 -b .v2_dirty_bitset_root echo %{version}-%{release} > VERSION %build @@ -88,6 +94,9 @@ make DESTDIR=%{buildroot} MANDIR=%{_mandir} install %{_sbindir}/thin_show_duplicates %changelog +* Mon Nov 20 2017 Marian Csontos - 0.7.0-0.1-rc6.el7_4.1 +- Fix v2 metadata corruption in cache_restore. + * Mon Mar 27 2017 Peter Rajnoha - 0.7.0-0.1-rc6 - Don't open devices as writeable if --clear-needs-check-flag is not set. - Fix cache metadata format version 2 superblock packing.