Add upstream patches that fix several 3.11.0 bugs

Signed-off-by: Jonathan Dieter <jdieter@lesbg.com>
This commit is contained in:
Jonathan Dieter 2017-05-20 15:43:42 +03:00
parent 55fb1c4385
commit 27425a82e0
4 changed files with 163 additions and 1 deletions

View File

@ -0,0 +1,43 @@
From f75fdceedb7ab91a2af2a26932f7f4a57000c8d1 Mon Sep 17 00:00:00 2001
From: Hazeman <hazeman@skytechnology.pl>
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

View File

@ -0,0 +1,65 @@
From 6b648fe7680610b23aeb890af6f8113b517953f5 Mon Sep 17 00:00:00 2001
From: Piotr Sarna <sarna@skytechnology.pl>
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<DirectoryEntry>{{7, "a1", dummy_attributes}}, current_time);
+ cache.insertSubsequent(LizardClient::Context(0, 0, 0, 0), 9, 1, std::vector<DirectoryEntry>{{7, "a1", dummy_attributes}}, current_time);
+ cache.removeOldest(5);
+}
--
2.9.3

View File

@ -0,0 +1,43 @@
From d51c475d088149973d8683471ea4874f276bb35e Mon Sep 17 00:00:00 2001
From: Piotr Sarna <sarna@skytechnology.pl>
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<pollfd> &pdesc) {
eptr->wrepcounter = 0;
eptr->delcounter = 0;
eptr->csdb = nullptr;
+ eptr->load_factor = 0;
chunk_server_unlabelled_connected();
} else {
tcpclose(ns);
--
2.9.3

View File

@ -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 <jdieter@lesbg.com> - 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 <jdieter@lesbg.com> - 3.10.6-7
- Switch to upstream patch for building with GCC 7