From 27425a82e0b80709c257f4e8737ce4968886dc1d Mon Sep 17 00:00:00 2001 From: Jonathan Dieter Date: Sat, 20 May 2017 15:43:42 +0300 Subject: [PATCH] Add upstream patches that fix several 3.11.0 bugs Signed-off-by: Jonathan Dieter --- ...h-cpu-usage-in-fs_periodic_file_test.patch | 43 ++++++++++++ ...irentry-cache-bug-for-repeated-paths.patch | 65 +++++++++++++++++++ ...d-missing-initializer-to-load_factor.patch | 43 ++++++++++++ lizardfs.spec | 13 +++- 4 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 0001-master-Fix-high-cpu-usage-in-fs_periodic_file_test.patch create mode 100644 0001-mount-Fix-direntry-cache-bug-for-repeated-paths.patch create mode 100644 0002-master-Add-missing-initializer-to-load_factor.patch diff --git a/0001-master-Fix-high-cpu-usage-in-fs_periodic_file_test.patch b/0001-master-Fix-high-cpu-usage-in-fs_periodic_file_test.patch new file mode 100644 index 0000000..35fe828 --- /dev/null +++ b/0001-master-Fix-high-cpu-usage-in-fs_periodic_file_test.patch @@ -0,0 +1,43 @@ +From f75fdceedb7ab91a2af2a26932f7f4a57000c8d1 Mon Sep 17 00:00:00 2001 +From: Hazeman +Date: Thu, 11 May 2017 10:06:11 +0200 +Subject: [PATCH 1/2] master: Fix high cpu usage in fs_periodic_file_test + +This commit fixes high cpu usage in fs_periodic_file_test. + +Fixes #547 + +Change-Id: Ia93173dd0f358f3ff606c7ebb5848f2b786b2158 +--- + src/master/filesystem_periodic.cc | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/src/master/filesystem_periodic.cc b/src/master/filesystem_periodic.cc +index 61b60d9..cb42ced 100644 +--- a/src/master/filesystem_periodic.cc ++++ b/src/master/filesystem_periodic.cc +@@ -332,9 +332,6 @@ void fs_process_file_test() { + static uint32_t unavailreservedfiles = 0; + + FSNode *f; +- if (eventloop_time() <= gTestStartTime) { +- return; +- } + + if (gFileTestLoopIndex == 0) { + fsinfo_files = files; +@@ -474,6 +471,11 @@ void fs_process_file_test() { + } + + void fs_periodic_file_test() { ++ if (eventloop_time() <= gTestStartTime) { ++ gFileTestLoopBucketLimit = 0; ++ return; ++ } ++ + if (gFileTestLoopBucketLimit == 0) { + gFileTestLoopBucketLimit = NODEHASHSIZE / gFileTestLoopTime; + fs_process_file_test(); +-- +2.9.3 + diff --git a/0001-mount-Fix-direntry-cache-bug-for-repeated-paths.patch b/0001-mount-Fix-direntry-cache-bug-for-repeated-paths.patch new file mode 100644 index 0000000..61717c9 --- /dev/null +++ b/0001-mount-Fix-direntry-cache-bug-for-repeated-paths.patch @@ -0,0 +1,65 @@ +From 6b648fe7680610b23aeb890af6f8113b517953f5 Mon Sep 17 00:00:00 2001 +From: Piotr Sarna +Date: Tue, 16 May 2017 13:41:15 +0200 +Subject: [PATCH] mount: Fix direntry cache bug for repeated paths + +This commit fixes a bug which caused direntry cache to crash +if two different nodes with same parent and name appear simultaneously +in cache. + +Closes #551 + +Change-Id: I0279c5ea492ccb7b4d4df7e83f01e69ee8c3d954 +--- + src/mount/direntry_cache.h | 7 +++++++ + src/mount/direntry_cache_unittest.cc | 12 ++++++++++++ + 2 files changed, 19 insertions(+) + +diff --git a/src/mount/direntry_cache.h b/src/mount/direntry_cache.h +index 1c27a14..69a21c4 100644 +--- a/src/mount/direntry_cache.h ++++ b/src/mount/direntry_cache.h +@@ -343,13 +343,20 @@ public: + IndexCompare()); + std::size_t current_index = first_index; + for (const DirectoryEntry &de : container) { ++ auto lookup_it = find(ctx, parent_inode, de.name); + if (it == index_set_.end() || + std::make_tuple(parent_inode, ctx.uid, ctx.gid) != + std::make_tuple(it->parent_inode, it->uid, it->gid) || + it->index != current_index) { ++ if (lookup_it != lookup_end()) { ++ erase(std::addressof(*lookup_it)); ++ } + it = addEntry(ctx, parent_inode, de.inode, current_index, de.name, + de.attributes, timestamp); + } else { ++ if (lookup_it != lookup_end() && it != index_set_.iterator_to(*lookup_it)) { ++ erase(std::addressof(*lookup_it)); ++ } + overwriteEntry(*it, de, timestamp); + } + ++it; +diff --git a/src/mount/direntry_cache_unittest.cc b/src/mount/direntry_cache_unittest.cc +index 279488f..1199dc2 100644 +--- a/src/mount/direntry_cache_unittest.cc ++++ b/src/mount/direntry_cache_unittest.cc +@@ -83,3 +83,15 @@ TEST(DirEntryCache, Basic) { + by_inode_it++; + ASSERT_EQ(by_inode_it, cache.inode_end()); + } ++ ++TEST(DirEntryCache, Repetitions) { ++ DirEntryCache cache(5000000); ++ ++ Attributes dummy_attributes; ++ dummy_attributes.fill(0); ++ auto current_time = cache.updateTime(); ++ ++ cache.insertSubsequent(LizardClient::Context(0, 0, 0, 0), 9, 0, std::vector{{7, "a1", dummy_attributes}}, current_time); ++ cache.insertSubsequent(LizardClient::Context(0, 0, 0, 0), 9, 1, std::vector{{7, "a1", dummy_attributes}}, current_time); ++ cache.removeOldest(5); ++} +-- +2.9.3 + diff --git a/0002-master-Add-missing-initializer-to-load_factor.patch b/0002-master-Add-missing-initializer-to-load_factor.patch new file mode 100644 index 0000000..e78a969 --- /dev/null +++ b/0002-master-Add-missing-initializer-to-load_factor.patch @@ -0,0 +1,43 @@ +From d51c475d088149973d8683471ea4874f276bb35e Mon Sep 17 00:00:00 2001 +From: Piotr Sarna +Date: Thu, 11 May 2017 15:55:34 +0200 +Subject: [PATCH 2/2] master: Add missing initializer to load_factor + +This commit adds missing initialization of load_factor member +to avoid valgrind warnings. + +Change-Id: Ifca5ad0afd781c6fc23090206750a6fe66573f10 +--- + src/master/get_servers_for_new_chunk.h | 3 ++- + src/master/matocsserv.cc | 1 + + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/master/get_servers_for_new_chunk.h b/src/master/get_servers_for_new_chunk.h +index a28687e..1c4518d 100644 +--- a/src/master/get_servers_for_new_chunk.h ++++ b/src/master/get_servers_for_new_chunk.h +@@ -36,7 +36,8 @@ struct ChunkserverChunkCounter { + label(), + weight(), + version(), +- chunks_created() { ++ chunks_created(), ++ load_factor() { + } + + ChunkserverChunkCounter(matocsserventry *server, MediaLabel label, int64_t weight, +diff --git a/src/master/matocsserv.cc b/src/master/matocsserv.cc +index 7e887e3..c99918a 100644 +--- a/src/master/matocsserv.cc ++++ b/src/master/matocsserv.cc +@@ -1710,6 +1710,7 @@ void matocsserv_serve(const std::vector &pdesc) { + eptr->wrepcounter = 0; + eptr->delcounter = 0; + eptr->csdb = nullptr; ++ eptr->load_factor = 0; + chunk_server_unlabelled_connected(); + } else { + tcpclose(ns); +-- +2.9.3 + diff --git a/lizardfs.spec b/lizardfs.spec index e667b03..217f84c 100644 --- a/lizardfs.spec +++ b/lizardfs.spec @@ -1,7 +1,7 @@ Name: lizardfs Summary: Distributed, fault tolerant file system Version: 3.11.0 -Release: 1%{?dist} +Release: 2%{?dist} # LizardFS is under GPLv3 while crcutil is under ASL 2.0 and there's one header, # src/common/coroutine.h, under the Boost license License: GPLv3 and ASL 2.0 and Boost @@ -13,6 +13,12 @@ Source2: 95-lizardfs.conf # Make sure we drop supplementary groups when running setgid # Pull request at https://github.com/lizardfs/lizardfs/pull/533 Patch1: 0001-main-Remove-supplementary-groups-when-dropping-privi.patch +# Upstream patch that fixes high CPU usage bug +Patch2: 0001-master-Fix-high-cpu-usage-in-fs_periodic_file_test.patch +# Upstream patch that adds missing initializer +Patch3: 0002-master-Add-missing-initializer-to-load_factor.patch +# Upstream patch that fixes direntry cache bug +Patch4: 0001-mount-Fix-direntry-cache-bug-for-repeated-paths.patch BuildRequires: fuse-devel BuildRequires: cmake BuildRequires: pkgconfig @@ -410,6 +416,11 @@ install -m644 %{SOURCE2} %{buildroot}%{_sysconfdir}/security/limits.d/95-lizardf %changelog +* Sat May 20 2017 Jonathan Dieter - 3.11.0-2 +- Update to 3.11.0 which fixes bug where goals are all empty +- Remove upstreamed patches +- Add new upstream patches that fix bugs in 3.11.0 + * Tue Apr 25 2017 Jonathan Dieter - 3.10.6-7 - Switch to upstream patch for building with GCC 7