backport bugfix patch from community
This commit is contained in:
parent
66910dcf6a
commit
11c1b81d39
@ -0,0 +1,38 @@
|
||||
From d2d6ab79266fb8778c67b803d654eefdc94791f6 Mon Sep 17 00:00:00 2001
|
||||
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||
Date: Tue, 24 Aug 2021 16:20:50 +0800
|
||||
Subject: [PATCH] Check consistency of thin_ids before running a regular dump
|
||||
|
||||
---
|
||||
thin-provisioning/metadata_dumper.cc | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/thin-provisioning/metadata_dumper.cc b/thin-provisioning/metadata_dumper.cc
|
||||
index 4feb40f..b462781 100644
|
||||
--- a/thin-provisioning/metadata_dumper.cc
|
||||
+++ b/thin-provisioning/metadata_dumper.cc
|
||||
@@ -405,6 +405,9 @@ namespace {
|
||||
if (rhs == ms.end())
|
||||
continue;
|
||||
|
||||
+ if (lhs->second != rhs->second)
|
||||
+ continue;
|
||||
+
|
||||
filtered.push_back(make_pair(p.first.b, p.second.b));
|
||||
}
|
||||
|
||||
@@ -867,8 +870,9 @@ namespace {
|
||||
|
||||
auto tm = open_tm(bm, superblock_detail::SUPERBLOCK_LOCATION);
|
||||
|
||||
- if (!get_dev_ids(*tm, msb->device_details_root_) ||
|
||||
- !get_map_ids(*tm, msb->data_mapping_root_))
|
||||
+ auto maybe_dev_ids = get_dev_ids(*tm, msb->device_details_root_);
|
||||
+ auto maybe_map_ids = get_map_ids(*tm, msb->data_mapping_root_);
|
||||
+ if (!maybe_dev_ids || !maybe_map_ids || (*maybe_dev_ids) != (*maybe_map_ids))
|
||||
find_better_roots_(bm, *msb);
|
||||
|
||||
emit_trees_(bm, *msb, e, opts);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
67
0005-Fix-sorting-of-data-mapping-candidates.patch
Normal file
67
0005-Fix-sorting-of-data-mapping-candidates.patch
Normal file
@ -0,0 +1,67 @@
|
||||
From c286041f2595c50ced44987343c81a34d7698c23 Mon Sep 17 00:00:00 2001
|
||||
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||
Date: Mon, 16 Aug 2021 18:16:29 +0800
|
||||
Subject: [PATCH] [thin_repair/thin_dump] Fix sorting of data mapping
|
||||
candidates
|
||||
|
||||
- Fix the references for sorting. The timestamp statistics is stored
|
||||
in node_info corresponding to the second element.
|
||||
- Fix the timestamp comparison routine. The mapping root with more recent
|
||||
blocks should have higher priority.
|
||||
---
|
||||
thin-provisioning/metadata_dumper.cc | 37 +++++++++++++++++-----------
|
||||
1 file changed, 22 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/thin-provisioning/metadata_dumper.cc b/thin-provisioning/metadata_dumper.cc
|
||||
index 665c7624..37c69694 100644
|
||||
--- a/thin-provisioning/metadata_dumper.cc
|
||||
+++ b/thin-provisioning/metadata_dumper.cc
|
||||
@@ -252,26 +252,33 @@ namespace {
|
||||
|
||||
bool cmp_time_counts(pair<node_info, node_info> const &lhs_pair,
|
||||
pair<node_info, node_info> const &rhs_pair) {
|
||||
- auto const &lhs = lhs_pair.first.time_counts;
|
||||
- auto const &rhs = rhs_pair.first.time_counts;
|
||||
+ auto const &lhs = lhs_pair.second.time_counts;
|
||||
+ auto const &rhs = rhs_pair.second.time_counts;
|
||||
|
||||
- for (auto lhs_it = lhs.crbegin(); lhs_it != lhs.crend(); lhs_it++) {
|
||||
- for (auto rhs_it = rhs.crbegin(); rhs_it != rhs.crend(); rhs_it++) {
|
||||
- if (lhs_it->first > rhs_it->first)
|
||||
- return true;
|
||||
|
||||
- else if (rhs_it->first > lhs_it->first)
|
||||
- return false;
|
||||
+ auto lhs_it = lhs.crbegin();
|
||||
+ auto rhs_it = rhs.crbegin();
|
||||
+ while (lhs_it != lhs.crend() && rhs_it != rhs.crend()) {
|
||||
|
||||
- else if (lhs_it->second > rhs_it->second)
|
||||
- return true;
|
||||
+ auto lhs_time = lhs_it->first;
|
||||
+ auto rhs_time = rhs_it->first;
|
||||
+ auto lhs_count = lhs_it->second;
|
||||
+ auto rhs_count = rhs_it->second;
|
||||
|
||||
- else if (rhs_it->second > lhs_it->second)
|
||||
- return false;
|
||||
- }
|
||||
- }
|
||||
+ if (lhs_time > rhs_time)
|
||||
+ return true;
|
||||
+ else if (rhs_time > lhs_time)
|
||||
+ return false;
|
||||
+ else if (lhs_count > rhs_count)
|
||||
+ return true;
|
||||
+ else if (rhs_count > lhs_count)
|
||||
+ return false;
|
||||
+
|
||||
+ lhs_it++;
|
||||
+ rhs_it++;
|
||||
+ }
|
||||
|
||||
- return true;
|
||||
+ return (lhs_it != lhs.crend()) ? true : false;
|
||||
}
|
||||
|
||||
class gatherer {
|
||||
22
0006-btree-Fix-rebalancing-checks.patch
Normal file
22
0006-btree-Fix-rebalancing-checks.patch
Normal file
@ -0,0 +1,22 @@
|
||||
From 8bfe7ee6f3fa89482a09d3c6ea933759f4d4b4a7 Mon Sep 17 00:00:00 2001
|
||||
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||
Date: Thu, 25 Mar 2021 15:06:52 +0800
|
||||
Subject: [PATCH] [btree] Fix rebalancing checks
|
||||
|
||||
---
|
||||
persistent-data/data-structures/btree.tcc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/persistent-data/data-structures/btree.tcc b/persistent-data/data-structures/btree.tcc
|
||||
index 059ebaab..27c9adc2 100644
|
||||
--- a/persistent-data/data-structures/btree.tcc
|
||||
+++ b/persistent-data/data-structures/btree.tcc
|
||||
@@ -338,7 +338,7 @@ namespace persistent_data {
|
||||
unsigned nr_right = rhs.get_nr_entries();
|
||||
unsigned max_entries = get_max_entries();
|
||||
|
||||
- if (nr_left - count > max_entries || nr_right - count > max_entries)
|
||||
+ if (nr_left - count > max_entries || nr_right + count > max_entries)
|
||||
throw runtime_error("too many entries");
|
||||
|
||||
if (count > 0) {
|
||||
39
0007-all-Fix-resource-leaks.patch
Normal file
39
0007-all-Fix-resource-leaks.patch
Normal file
@ -0,0 +1,39 @@
|
||||
From f7e4a8faa920a1d9746b056e9820da13b5b488e7 Mon Sep 17 00:00:00 2001
|
||||
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||
Date: Wed, 28 Apr 2021 10:34:16 +0800
|
||||
Subject: [PATCH] [all] Fix resource leaks
|
||||
|
||||
---
|
||||
base/file_utils.cc | 4 +++-
|
||||
thin-provisioning/cache_stream.cc | 2 +-
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/base/file_utils.cc b/base/file_utils.cc
|
||||
index e4f37228..82536608 100644
|
||||
--- a/base/file_utils.cc
|
||||
+++ b/base/file_utils.cc
|
||||
@@ -155,8 +155,10 @@ file_utils::zero_superblock(std::string const &path)
|
||||
throw runtime_error("out of memory");
|
||||
|
||||
memset(buffer, 0, SUPERBLOCK_SIZE);
|
||||
- if (::write(fd.fd_, buffer, SUPERBLOCK_SIZE) != SUPERBLOCK_SIZE)
|
||||
+ if (::write(fd.fd_, buffer, SUPERBLOCK_SIZE) != SUPERBLOCK_SIZE) {
|
||||
+ free(buffer);
|
||||
throw runtime_error("couldn't zero superblock");
|
||||
+ }
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
diff --git a/thin-provisioning/cache_stream.cc b/thin-provisioning/cache_stream.cc
|
||||
index 002b6ba9..73b01b4e 100644
|
||||
--- a/thin-provisioning/cache_stream.cc
|
||||
+++ b/thin-provisioning/cache_stream.cc
|
||||
@@ -62,7 +62,7 @@ chunk const &
|
||||
cache_stream::get()
|
||||
{
|
||||
chunk_wrapper *w = new chunk_wrapper(*this);
|
||||
- return w->c_;
|
||||
+ return w->c_; // wrapper will get freed by the put method
|
||||
}
|
||||
|
||||
void
|
||||
23
0008-thin_show_metadata-Fix-out-of-bounds-access.patch
Normal file
23
0008-thin_show_metadata-Fix-out-of-bounds-access.patch
Normal file
@ -0,0 +1,23 @@
|
||||
From 0004dced935879e190dd660e1f82f1d751454c78 Mon Sep 17 00:00:00 2001
|
||||
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||
Date: Tue, 1 Jun 2021 11:24:11 +0800
|
||||
Subject: [PATCH] [thin_show_metadata] Fix out-of-bounds access
|
||||
|
||||
---
|
||||
thin-provisioning/thin_show_metadata.cc | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/thin-provisioning/thin_show_metadata.cc b/thin-provisioning/thin_show_metadata.cc
|
||||
index bdbab3f7..dbc7a80c 100644
|
||||
--- a/thin-provisioning/thin_show_metadata.cc
|
||||
+++ b/thin-provisioning/thin_show_metadata.cc
|
||||
@@ -206,7 +206,8 @@ namespace {
|
||||
|
||||
void run() {
|
||||
auto line_length = 80;
|
||||
- for (block_address b = 0; b < 2000; b++) {
|
||||
+ block_address nr_blocks = std::min<block_address>(2000, bm_.get_nr_blocks());
|
||||
+ for (block_address b = 0; b < nr_blocks; b++) {
|
||||
block_manager::read_ref rr = bm_.read_lock(b);
|
||||
|
||||
if (!(b % line_length)) {
|
||||
22
0009-build-Fix-customized-emitter-linkage.patch
Normal file
22
0009-build-Fix-customized-emitter-linkage.patch
Normal file
@ -0,0 +1,22 @@
|
||||
From 041ed7858c887f2ae0c300741c61b8c8af7afe55 Mon Sep 17 00:00:00 2001
|
||||
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||
Date: Tue, 1 Jun 2021 13:32:26 +0800
|
||||
Subject: [PATCH] [build] Fix customized emitter linkage
|
||||
|
||||
---
|
||||
contrib/Makefile.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/contrib/Makefile.in b/contrib/Makefile.in
|
||||
index 038c41c7..71922588 100644
|
||||
--- a/contrib/Makefile.in
|
||||
+++ b/contrib/Makefile.in
|
||||
@@ -18,7 +18,7 @@ contrib/%.a: contrib/%.o
|
||||
$(V)echo " [AR] $@"
|
||||
$(V)$(AR) rcs $@ $^
|
||||
|
||||
-contrib/%.so: contrib/%.a
|
||||
+contrib/%.so: contrib/%.o
|
||||
$(V)echo " [LD] $@"
|
||||
$(V)$(CC) -shared -Wl,-soname,$@ -o $@ $<
|
||||
|
||||
136
0010-thin_dump-Fix-leaked-shared-object-handle.patch
Normal file
136
0010-thin_dump-Fix-leaked-shared-object-handle.patch
Normal file
@ -0,0 +1,136 @@
|
||||
From 75c0a3656c700eabf13a4bbf09421871c77a5f43 Mon Sep 17 00:00:00 2001
|
||||
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||
Date: Tue, 1 Jun 2021 23:37:36 +0800
|
||||
Subject: [PATCH] [thin_dump] Fix leaked shared object handle
|
||||
|
||||
---
|
||||
thin-provisioning/shared_library_emitter.cc | 113 +++++++++++++++++---
|
||||
1 file changed, 100 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/thin-provisioning/shared_library_emitter.cc b/thin-provisioning/shared_library_emitter.cc
|
||||
index 58f12d29..2e845f34 100644
|
||||
--- a/thin-provisioning/shared_library_emitter.cc
|
||||
+++ b/thin-provisioning/shared_library_emitter.cc
|
||||
@@ -8,22 +8,109 @@ using namespace thin_provisioning;
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
-emitter::ptr
|
||||
-thin_provisioning::create_custom_emitter(string const &shared_lib, ostream &out)
|
||||
-{
|
||||
- emitter::ptr (*create_fn)(ostream &out);
|
||||
- void *handle = dlopen(shared_lib.c_str(), RTLD_LAZY);
|
||||
- if (!handle)
|
||||
- throw runtime_error(dlerror());
|
||||
+struct shared_object {
|
||||
+public:
|
||||
+ shared_object(const char *shared_lib) {
|
||||
+ handle_ = dlopen(shared_lib, RTLD_LAZY);
|
||||
+ if (!handle_)
|
||||
+ throw runtime_error(dlerror());
|
||||
+
|
||||
+ dlerror(); // Clear any existing error
|
||||
+ }
|
||||
+
|
||||
+ virtual ~shared_object() {
|
||||
+ dlclose(handle_);
|
||||
+ }
|
||||
+
|
||||
+ void *get_symbol(const char *symbol) {
|
||||
+ void *sym = dlsym(handle_, symbol);
|
||||
+
|
||||
+ char *error = dlerror();
|
||||
+ if (error)
|
||||
+ throw runtime_error(error);
|
||||
+
|
||||
+ return sym;
|
||||
+ }
|
||||
+
|
||||
+ void *handle_;
|
||||
+};
|
||||
+
|
||||
+class shared_emitter : public emitter {
|
||||
+public:
|
||||
+ shared_emitter(const char *shared_lib, ostream &out): sobj_(shared_lib) {
|
||||
+ emitter::ptr (*create_fn)(ostream &out);
|
||||
+ create_fn = reinterpret_cast<emitter::ptr (*)(ostream &)>(
|
||||
+ sobj_.get_symbol("create_emitter"));
|
||||
+ inner_ = create_fn(out);
|
||||
+ }
|
||||
+
|
||||
+ virtual ~shared_emitter() {
|
||||
+ }
|
||||
+
|
||||
+ void begin_superblock(std::string const &uuid,
|
||||
+ uint64_t time,
|
||||
+ uint64_t trans_id,
|
||||
+ boost::optional<uint32_t> flags,
|
||||
+ boost::optional<uint32_t> version,
|
||||
+ uint32_t data_block_size,
|
||||
+ uint64_t nr_data_blocks,
|
||||
+ boost::optional<uint64_t> metadata_snap) {
|
||||
+ inner_->begin_superblock(uuid,
|
||||
+ time,
|
||||
+ trans_id,
|
||||
+ flags,
|
||||
+ version,
|
||||
+ data_block_size,
|
||||
+ nr_data_blocks,
|
||||
+ metadata_snap);
|
||||
+ }
|
||||
|
||||
- dlerror(); // Clear any existing error
|
||||
- create_fn = reinterpret_cast<emitter::ptr (*)(ostream &)>(dlsym(handle, "create_emitter"));
|
||||
+ void end_superblock() {
|
||||
+ inner_->end_superblock();
|
||||
+ }
|
||||
|
||||
- char *error = dlerror();
|
||||
- if (error)
|
||||
- throw runtime_error(error);
|
||||
+ void begin_device(uint32_t dev_id,
|
||||
+ uint64_t mapped_blocks,
|
||||
+ uint64_t trans_id,
|
||||
+ uint64_t creation_time,
|
||||
+ uint64_t snap_time) {
|
||||
+ inner_->begin_device(dev_id, mapped_blocks, trans_id, creation_time, snap_time);
|
||||
+ }
|
||||
|
||||
- return create_fn(out);
|
||||
+ void end_device() {
|
||||
+ inner_->end_device();
|
||||
+ }
|
||||
+
|
||||
+ void begin_named_mapping(std::string const &name) {
|
||||
+ inner_->begin_named_mapping(name);
|
||||
+ }
|
||||
+
|
||||
+ void end_named_mapping() {
|
||||
+ inner_->end_named_mapping();
|
||||
+ }
|
||||
+
|
||||
+ void identifier(std::string const &name) {
|
||||
+ inner_->identifier(name);
|
||||
+ }
|
||||
+
|
||||
+ void range_map(uint64_t origin_begin, uint64_t data_begin, uint32_t time, uint64_t len) {
|
||||
+ inner_->range_map(origin_begin, data_begin, time, len);
|
||||
+ }
|
||||
+
|
||||
+ void single_map(uint64_t origin_block, uint64_t data_block, uint32_t time) {
|
||||
+ inner_->single_map(origin_block, data_block, time);
|
||||
+ }
|
||||
+
|
||||
+ shared_object sobj_;
|
||||
+ emitter::ptr inner_;
|
||||
+};
|
||||
+
|
||||
+//----------------------------------------------------------------
|
||||
+
|
||||
+emitter::ptr
|
||||
+thin_provisioning::create_custom_emitter(string const &shared_lib, ostream &out)
|
||||
+{
|
||||
+ return emitter::ptr(new shared_emitter(shared_lib.c_str(), out));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
49
0011-thin_show_duplicates-Fix-potential-errors.patch
Normal file
49
0011-thin_show_duplicates-Fix-potential-errors.patch
Normal file
@ -0,0 +1,49 @@
|
||||
From 759407445f4e1c31cc0d7bff2881ebd981e2d8fe Mon Sep 17 00:00:00 2001
|
||||
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||
Date: Wed, 2 Jun 2021 01:23:13 +0800
|
||||
Subject: [PATCH] [thin_show_duplicates] Fix potential errors
|
||||
|
||||
- Fix error if no --block-sector provided
|
||||
- Fix errors on pools without mappings, or zero-length file
|
||||
---
|
||||
thin-provisioning/thin_show_duplicates.cc | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/thin-provisioning/thin_show_duplicates.cc b/thin-provisioning/thin_show_duplicates.cc
|
||||
index b1eebb74..f7354eb4 100644
|
||||
--- a/thin-provisioning/thin_show_duplicates.cc
|
||||
+++ b/thin-provisioning/thin_show_duplicates.cc
|
||||
@@ -56,7 +56,7 @@ using namespace thin_provisioning;
|
||||
|
||||
namespace {
|
||||
bool factor_of(block_address f, block_address n) {
|
||||
- return (n % f) == 0;
|
||||
+ return f && (n % f) == 0;
|
||||
}
|
||||
|
||||
uint64_t parse_int(string const &str, string const &desc) {
|
||||
@@ -132,11 +132,15 @@ namespace {
|
||||
class duplicate_detector {
|
||||
public:
|
||||
void scan_with_variable_sized_chunks(chunk_stream &stream) {
|
||||
+ if (!stream.size())
|
||||
+ return;
|
||||
variable_chunk_stream vstream(stream, 4096);
|
||||
scan(vstream);
|
||||
}
|
||||
|
||||
void scan_with_fixed_sized_chunks(chunk_stream &stream, block_address chunk_size) {
|
||||
+ if (!stream.size())
|
||||
+ return;
|
||||
fixed_chunk_stream fstream(stream, chunk_size);
|
||||
scan(fstream);
|
||||
}
|
||||
@@ -222,7 +226,7 @@ namespace {
|
||||
if (fs.content_based_chunks)
|
||||
detector.scan_with_variable_sized_chunks(pstream);
|
||||
else {
|
||||
- if (*fs.block_size) {
|
||||
+ if (!!fs.block_size) {
|
||||
if (factor_of(*fs.block_size, block_size))
|
||||
block_size = *fs.block_size;
|
||||
else
|
||||
80
0012-all-Fix-uninitialized-class-members.patch
Normal file
80
0012-all-Fix-uninitialized-class-members.patch
Normal file
@ -0,0 +1,80 @@
|
||||
From 2e62363446389f6d160a0a10d7ab3e735401bb6c Mon Sep 17 00:00:00 2001
|
||||
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||
Date: Wed, 2 Jun 2021 12:14:34 +0800
|
||||
Subject: [PATCH] [all] Fix uninitialized class members
|
||||
|
||||
---
|
||||
era/restore_emitter.cc | 1 +
|
||||
thin-provisioning/metadata_dumper.cc | 10 +++++++---
|
||||
thin-provisioning/thin_delta.cc | 4 +++-
|
||||
3 files changed, 11 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/era/restore_emitter.cc b/era/restore_emitter.cc
|
||||
index c09fa665..7fbac7db 100644
|
||||
--- a/era/restore_emitter.cc
|
||||
+++ b/era/restore_emitter.cc
|
||||
@@ -14,6 +14,7 @@ namespace {
|
||||
: md_(md),
|
||||
in_superblock_(false),
|
||||
in_writeset_(false),
|
||||
+ era_(0),
|
||||
in_era_array_(false) {
|
||||
}
|
||||
|
||||
diff --git a/thin-provisioning/metadata_dumper.cc b/thin-provisioning/metadata_dumper.cc
|
||||
index 4feb40f6..665c7624 100644
|
||||
--- a/thin-provisioning/metadata_dumper.cc
|
||||
+++ b/thin-provisioning/metadata_dumper.cc
|
||||
@@ -180,7 +180,7 @@ namespace {
|
||||
// This is about classifying and summarising btree nodes. The use of a btree
|
||||
// node may not be obvious when inspecting it in isolation. But more information
|
||||
// may be gleaned by examining child and sibling nodes.
|
||||
-//
|
||||
+//
|
||||
// So the process is:
|
||||
// - scan every metadata block, summarising it's potential uses.
|
||||
// - repeatedly iterate those summaries until we can glean no more useful information.
|
||||
@@ -474,7 +474,7 @@ namespace {
|
||||
node_info get_internal_info(block_manager::read_ref &rr) {
|
||||
node_info info;
|
||||
info.b = rr.get_location();
|
||||
-
|
||||
+
|
||||
// values refer to blocks, so we should have infos for them.
|
||||
auto n = to_node<block_traits>(rr);
|
||||
::uint64_t key_low = 0;
|
||||
@@ -524,7 +524,7 @@ namespace {
|
||||
node_info info;
|
||||
info.b = rr.get_location();
|
||||
|
||||
- auto vsize = to_cpu<uint32_t>(hdr.value_size);
|
||||
+ auto vsize = to_cpu<uint32_t>(hdr.value_size);
|
||||
info.values = to_cpu<uint32_t>(hdr.nr_entries);
|
||||
|
||||
if (vsize == sizeof(device_details_traits::disk_type)) {
|
||||
@@ -645,6 +645,10 @@ namespace {
|
||||
public:
|
||||
mapping_emit_visitor(emitter::ptr e)
|
||||
: e_(e),
|
||||
+ origin_start_(0),
|
||||
+ dest_start_(0),
|
||||
+ time_(0),
|
||||
+ len_(0),
|
||||
in_range_(false) {
|
||||
}
|
||||
|
||||
diff --git a/thin-provisioning/thin_delta.cc b/thin-provisioning/thin_delta.cc
|
||||
index 0eb119e6..56f97fac 100644
|
||||
--- a/thin-provisioning/thin_delta.cc
|
||||
+++ b/thin-provisioning/thin_delta.cc
|
||||
@@ -214,7 +214,9 @@ namespace {
|
||||
class simple_emitter : public diff_emitter {
|
||||
public:
|
||||
simple_emitter(indented_stream &out)
|
||||
- : diff_emitter(out) {
|
||||
+ : diff_emitter(out),
|
||||
+ vbegin_(0),
|
||||
+ vend_(0) {
|
||||
}
|
||||
|
||||
void left_only(uint64_t vbegin, uint64_t dbegin, uint64_t len) {
|
||||
30
0013-thin_metadata_size-Fix-potential-string-overflow.patch
Normal file
30
0013-thin_metadata_size-Fix-potential-string-overflow.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From 3145a1f4ded700cfda3f2dffc203cc5c3cfb1d13 Mon Sep 17 00:00:00 2001
|
||||
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||
Date: Wed, 2 Jun 2021 11:39:01 +0800
|
||||
Subject: [PATCH] [thin_metadata_size] Fix potential string overflow
|
||||
|
||||
---
|
||||
thin-provisioning/thin_metadata_size.cc | 10 +++++++---
|
||||
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/thin-provisioning/thin_metadata_size.cc b/thin-provisioning/thin_metadata_size.cc
|
||||
index b6a5718e..f14696c3 100644
|
||||
--- a/thin-provisioning/thin_metadata_size.cc
|
||||
+++ b/thin-provisioning/thin_metadata_size.cc
|
||||
@@ -192,9 +192,13 @@ static void printf_aligned(struct global *g, char const *a, char const *b, char
|
||||
{
|
||||
char buf[80];
|
||||
|
||||
- strcpy(buf, b);
|
||||
- if (units)
|
||||
- strcat(buf, mandatory ? "{" :"["), strcat(buf, g->unit.chars), strcat(buf, mandatory ? "}" : "]");
|
||||
+ if (units) {
|
||||
+ char left_bracket = mandatory ? '{' : '[';
|
||||
+ char right_bracket = mandatory ? '}' : ']';
|
||||
+ snprintf(buf, 80, "%s%c%s%c", b, left_bracket, g->unit.chars, right_bracket);
|
||||
+ } else {
|
||||
+ snprintf(buf, 80, "%s", b);
|
||||
+ }
|
||||
|
||||
printf("\t%-4s%-44s%s\n", a, buf, c);
|
||||
}
|
||||
21
0014-file_utils-Fix-resource-leak.patch
Normal file
21
0014-file_utils-Fix-resource-leak.patch
Normal file
@ -0,0 +1,21 @@
|
||||
From 429e7f01d73f65952a844c406191d27258b353db Mon Sep 17 00:00:00 2001
|
||||
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||
Date: Fri, 4 Jun 2021 21:37:02 +0800
|
||||
Subject: [PATCH] [file_utils] Fix resource leak
|
||||
|
||||
---
|
||||
base/file_utils.cc | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/base/file_utils.cc b/base/file_utils.cc
|
||||
index 82536608..e6095f7a 100644
|
||||
--- a/base/file_utils.cc
|
||||
+++ b/base/file_utils.cc
|
||||
@@ -159,6 +159,7 @@ file_utils::zero_superblock(std::string const &path)
|
||||
free(buffer);
|
||||
throw runtime_error("couldn't zero superblock");
|
||||
}
|
||||
+ free(buffer);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
@ -1,6 +1,6 @@
|
||||
Name: thin-provisioning-tools
|
||||
Version: 0.9.0
|
||||
Release: 4
|
||||
Release: 5
|
||||
Summary: Tools for manipulating Device-mapper metadata
|
||||
License: GPLv3+
|
||||
URL: https://github.com/jthornber/thin-provisioning-tools
|
||||
@ -8,6 +8,17 @@ Source0: https://github.com/jthornber/thin-provisioning-tools/archive/v%{version
|
||||
Patch1: 0001-device-mapper-persistent-data-avoid-strip.patch
|
||||
Patch2: 0002-build-remove-lboost_iostreams-linker-flag.patch
|
||||
Patch3: 0003-thin_ll_dump-Fix-potential-segfault-while-reading-in.patch
|
||||
Patch4: 0004-Check-consistency-of-thin_ids-before-running-a-regul.patch
|
||||
Patch5: 0005-Fix-sorting-of-data-mapping-candidates.patch
|
||||
Patch6: 0006-btree-Fix-rebalancing-checks.patch
|
||||
Patch7: 0007-all-Fix-resource-leaks.patch
|
||||
Patch8: 0008-thin_show_metadata-Fix-out-of-bounds-access.patch
|
||||
Patch9: 0009-build-Fix-customized-emitter-linkage.patch
|
||||
Patch10: 0010-thin_dump-Fix-leaked-shared-object-handle.patch
|
||||
Patch11: 0011-thin_show_duplicates-Fix-potential-errors.patch
|
||||
Patch12: 0012-all-Fix-uninitialized-class-members.patch
|
||||
Patch13: 0013-thin_metadata_size-Fix-potential-string-overflow.patch
|
||||
Patch14: 0014-file_utils-Fix-resource-leak.patch
|
||||
|
||||
BuildRequires: autoconf, expat-devel
|
||||
BuildRequires: libaio-devel, libstdc++-devel
|
||||
@ -52,6 +63,9 @@ make DESTDIR=%{buildroot} MANDIR=%{_mandir} install
|
||||
%{_mandir}/man*/*
|
||||
|
||||
%changelog
|
||||
* Wed Jul 31 2024 wangzhiqiang <wangzhiqiang95@huawei.com> - 0.9.0-5
|
||||
- backport bugfix patch from community
|
||||
|
||||
* Fri Nov 4 2022 wuguanghao <wuguanghao3@huawei.com> - 0.9.0-4
|
||||
- backport bugfix patch from community
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user