diff --git a/.gitignore b/.gitignore index 1521ba3..c7cd7b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /lizardfs-3.10.6.tar.gz /lizardfs-3.11.0.tar.gz +/lizardfs-3.11.2.tar.gz diff --git a/0001-master-Fix-dangling-nodes-in-defective-files-list.patch b/0001-master-Fix-dangling-nodes-in-defective-files-list.patch deleted file mode 100644 index 27cbada..0000000 --- a/0001-master-Fix-dangling-nodes-in-defective-files-list.patch +++ /dev/null @@ -1,77 +0,0 @@ -From dad26eef2cf1a4570a87a74e7a4cbf1823b86073 Mon Sep 17 00:00:00 2001 -From: Hazeman -Date: Mon, 22 May 2017 11:14:48 +0200 -Subject: [PATCH] master: Fix dangling nodes in defective files list - -This commit fixes dangling entries in defective files list. - -Fixes #548 - -Change-Id: I3735fbbb1d7080f73db835196f993db31a4f1155 ---- - src/master/filesystem_node.cc | 2 ++ - src/master/filesystem_periodic.cc | 11 +++++++++++ - src/master/filesystem_periodic.h | 1 + - 3 files changed, 14 insertions(+) - -diff --git a/src/master/filesystem_node.cc b/src/master/filesystem_node.cc -index 7661738..8d1ef5c 100644 ---- a/src/master/filesystem_node.cc -+++ b/src/master/filesystem_node.cc -@@ -34,6 +34,7 @@ - #include "master/filesystem_freenode.h" - #include "master/filesystem_metadata.h" - #include "master/filesystem_operations.h" -+#include "master/filesystem_periodic.h" - #include "master/filesystem_quota.h" - #include "master/fs_context.h" - -@@ -1119,6 +1120,7 @@ static inline void fsnodes_remove_node(uint32_t ts, FSNode *toremove) { - fsnodes_quota_update(toremove, {{QuotaResource::kInodes, -1}}); - fsnodes_quota_remove(QuotaOwnerType::kInode, toremove->id); - #ifndef METARESTORE -+ fsnodes_periodic_remove(toremove->id); - dcm_modify(toremove->id, 0); - #endif - FSNode::destroy(toremove); -diff --git a/src/master/filesystem_periodic.cc b/src/master/filesystem_periodic.cc -index cb42ced..b8079aa 100644 ---- a/src/master/filesystem_periodic.cc -+++ b/src/master/filesystem_periodic.cc -@@ -169,6 +169,10 @@ void fs_test_getdata(uint32_t &loopstart, uint32_t &loopend, uint32_t &files, ui - } - - FSNode *node = fsnodes_id_to_node(entry.first); -+ if (!node) { -+ continue; -+ } -+ - if (node->type == FSNode::kFile || node->type == FSNode::kTrash || - node->type == FSNode::kReserved) { - FSNodeFile *file_node = static_cast(node); -@@ -490,6 +494,13 @@ void fs_background_file_test(void) { - } - } - } -+ -+void fsnodes_periodic_remove(uint32_t inode) { -+ auto it = gDefectiveNodes.find(inode); -+ if (it != gDefectiveNodes.end()) { -+ gDefectiveNodes.erase(it); -+ } -+} - #endif - - struct InodeInfo { -diff --git a/src/master/filesystem_periodic.h b/src/master/filesystem_periodic.h -index 1ef4e40..aa36f6e 100644 ---- a/src/master/filesystem_periodic.h -+++ b/src/master/filesystem_periodic.h -@@ -33,3 +33,4 @@ void fs_periodic_master_init(); - void fs_test_getdata(uint32_t &loopstart, uint32_t &loopend, uint32_t &files, uint32_t &ugfiles, - uint32_t &mfiles, uint32_t &chunks, uint32_t &ugchunks, uint32_t &mchunks, - std::string &report); -+void fsnodes_periodic_remove(uint32_t inode); --- -2.9.4 - 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 deleted file mode 100644 index 35fe828..0000000 --- a/0001-master-Fix-high-cpu-usage-in-fs_periodic_file_test.patch +++ /dev/null @@ -1,43 +0,0 @@ -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-master-Fix-issues-with-reporting-defective-files.patch b/0001-master-Fix-issues-with-reporting-defective-files.patch new file mode 100644 index 0000000..8cc8b4e --- /dev/null +++ b/0001-master-Fix-issues-with-reporting-defective-files.patch @@ -0,0 +1,119 @@ +From 0ff659db5d0847db2aa0d59be4955c16012d6fc2 Mon Sep 17 00:00:00 2001 +From: Piotr Sarna +Date: Mon, 12 Jun 2017 12:41:56 +0200 +Subject: [PATCH 1/3] master: Fix issues with reporting defective files + +This commit fixes printing paths for trash/reserved files +in defective files report and adds missing counter increments +in fs_test_getdata loop. + +Fixes #565 + +Change-Id: Ifb3932800b1d7998ff55cecb09fcc28a5dbc4717 +--- + src/master/filesystem_periodic.cc | 59 ++++++++++++++++++++------------------- + 1 file changed, 31 insertions(+), 28 deletions(-) + +diff --git a/src/master/filesystem_periodic.cc b/src/master/filesystem_periodic.cc +index d9fab6f9..8b7913fb 100644 +--- a/src/master/filesystem_periodic.cc ++++ b/src/master/filesystem_periodic.cc +@@ -92,36 +92,11 @@ void fs_background_task_manager_work() { + } + } + +-std::vector fs_get_defective_nodes_info(uint8_t requested_flags, uint64_t max_entries, +- uint64_t &entry_index) { +- FSNode *node; +- FSNodeDirectory *parent; +- std::string file_path; +- std::vector defective_nodes_info; +- ActiveLoopWatchdog watchdog; +- defective_nodes_info.reserve(max_entries); +- auto it = gDefectiveNodes.find_nth(entry_index); +- watchdog.start(); +- for (uint64_t i = 0; i < max_entries && it != gDefectiveNodes.end(); ++it) { +- if (((*it).second & requested_flags) != 0) { +- node = fsnodes_id_to_node((*it).first); +- parent = fsnodes_get_first_parent(node); +- fsnodes_getpath(parent, node, file_path); +- file_path = "/" + file_path; +- defective_nodes_info.emplace_back(file_path, (*it).second); +- ++i; +- } +- ++entry_index; +- if (watchdog.expired()) { +- return defective_nodes_info; +- } +- } +- entry_index = 0; +- return defective_nodes_info; +-} +- + static std::string get_node_info(FSNode *node) { + std::string name; ++ if (node == nullptr) { ++ return name; ++ } + if (node->type == FSNode::kTrash) { + name = "file in trash " + std::to_string(node->id) + ": " + + (std::string)gMetadata->trash.at(TrashPathKey(node)); +@@ -157,6 +132,30 @@ static std::string get_node_info(FSNode *node) { + return fsnodes_escape_name(name); + } + ++std::vector fs_get_defective_nodes_info(uint8_t requested_flags, uint64_t max_entries, ++ uint64_t &entry_index) { ++ FSNode *node; ++ std::vector defective_nodes_info; ++ ActiveLoopWatchdog watchdog; ++ defective_nodes_info.reserve(max_entries); ++ auto it = gDefectiveNodes.find_nth(entry_index); ++ watchdog.start(); ++ for (uint64_t i = 0; i < max_entries && it != gDefectiveNodes.end(); ++it) { ++ if (((*it).second & requested_flags) != 0) { ++ node = fsnodes_id_to_node((*it).first); ++ std::string info = get_node_info(node); ++ defective_nodes_info.emplace_back(std::move(info), (*it).second); ++ ++i; ++ } ++ ++entry_index; ++ if (watchdog.expired()) { ++ return defective_nodes_info; ++ } ++ } ++ entry_index = 0; ++ return defective_nodes_info; ++} ++ + void fs_test_getdata(uint32_t &loopstart, uint32_t &loopend, uint32_t &files, uint32_t &ugfiles, + uint32_t &mfiles, uint32_t &chunks, uint32_t &ugchunks, uint32_t &mchunks, + std::string &result) { +@@ -170,6 +169,8 @@ void fs_test_getdata(uint32_t &loopstart, uint32_t &loopend, uint32_t &files, ui + + FSNode *node = fsnodes_id_to_node(entry.first); + if (!node) { ++ report << "Structure error in defective list, entry " << std::to_string(entry.first) << "\n"; ++ errors++; + continue; + } + +@@ -213,6 +214,7 @@ void fs_test_getdata(uint32_t &loopstart, uint32_t &loopend, uint32_t &files, ui + report << "*"; + } + report << " currently unavailable " << name << "\n"; ++ errors++; + } + + if (errors >= ERRORS_LOG_MAX) { +@@ -222,6 +224,7 @@ void fs_test_getdata(uint32_t &loopstart, uint32_t &loopend, uint32_t &files, ui + if (entry.second & kStructureError) { + std::string name = get_node_info(node); + report << "Structure error in " << name << "\n"; ++ errors++; + } + + if (errors >= ERRORS_LOG_MAX) { +-- +2.13.0 + diff --git a/0001-mount-Add-missing-destructor-to-direntry-cache.patch b/0001-mount-Add-missing-destructor-to-direntry-cache.patch deleted file mode 100644 index 9951d59..0000000 --- a/0001-mount-Add-missing-destructor-to-direntry-cache.patch +++ /dev/null @@ -1,35 +0,0 @@ -From c47ad770036f84c136f28b4f80cfed425b9d973b Mon Sep 17 00:00:00 2001 -From: Piotr Sarna -Date: Fri, 12 May 2017 11:07:14 +0200 -Subject: [PATCH] mount: Add missing destructor to direntry cache - -This commit adds final cache clearing to the destructor. - -Change-Id: Ia2832c3f302809764ecb2a53c17be95bdb22aa9c ---- - src/mount/direntry_cache.h | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/src/mount/direntry_cache.h b/src/mount/direntry_cache.h -index 24971fb..1c27a14 100644 ---- a/src/mount/direntry_cache.h -+++ b/src/mount/direntry_cache.h -@@ -172,6 +172,15 @@ public: - : timer_(), current_time_(0), timeout_(timeout) { - } - -+ ~DirEntryCache() { -+ auto it = fifo_list_.begin(); -+ while (it != fifo_list_.end()) { -+ auto next_it = std::next(it); -+ erase(std::addressof(*it)); -+ it = next_it; -+ } -+ } -+ - /*! \brief Set cache entry expiration timeout (us). - * - * \param timeout entry expiration timeout (us). --- -2.9.4 - diff --git a/0001-mount-Fix-direntry-cache-bug-for-repeated-paths.patch b/0001-mount-Fix-direntry-cache-bug-for-repeated-paths.patch deleted file mode 100644 index 61717c9..0000000 --- a/0001-mount-Fix-direntry-cache-bug-for-repeated-paths.patch +++ /dev/null @@ -1,65 +0,0 @@ -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 deleted file mode 100644 index e78a969..0000000 --- a/0002-master-Add-missing-initializer-to-load_factor.patch +++ /dev/null @@ -1,43 +0,0 @@ -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/0002-mount-Fix-request-size-in-read-cache-for-empty-resul.patch b/0002-mount-Fix-request-size-in-read-cache-for-empty-resul.patch new file mode 100644 index 0000000..85cc8dd --- /dev/null +++ b/0002-mount-Fix-request-size-in-read-cache-for-empty-resul.patch @@ -0,0 +1,30 @@ +From 48004d85280a8d8483c0b1a85e3fe2db28967750 Mon Sep 17 00:00:00 2001 +From: Piotr Sarna +Date: Mon, 12 Jun 2017 17:24:34 +0200 +Subject: [PATCH 2/3] mount: Fix request size in read cache for empty results + +This commit makes empty cache results return correct '0' value +when checking its size. + +Change-Id: I9d2fa823bff46133bc471aae32155b5c8b21e11c +--- + src/mount/readdata_cache.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/mount/readdata_cache.h b/src/mount/readdata_cache.h +index 9043dc32..37f56e50 100644 +--- a/src/mount/readdata_cache.h ++++ b/src/mount/readdata_cache.h +@@ -186,6 +186,9 @@ public: + } + + Size requestSize(Offset real_offset, Size real_size) const { ++ if (entries.empty()) { ++ return 0; ++ } + assert(real_offset >= frontOffset()); + assert(real_offset <= endOffset()); + return std::min(endOffset() - real_offset, real_size); +-- +2.13.0 + diff --git a/0003-mount-Fix-read-request-size-with-disabled-readahead.patch b/0003-mount-Fix-read-request-size-with-disabled-readahead.patch new file mode 100644 index 0000000..2d91f15 --- /dev/null +++ b/0003-mount-Fix-read-request-size-with-disabled-readahead.patch @@ -0,0 +1,45 @@ +From 0b970d4e0cad10a70c920cad0437bf8b278df00d Mon Sep 17 00:00:00 2001 +From: Piotr Sarna +Date: Mon, 19 Jun 2017 14:38:05 +0200 +Subject: [PATCH 3/3] mount: Fix read request size with disabled readahead + +This commit makes read requests ask for proper size when readahead +feature is disabled (cacheexpirationtime set to 0). + +Change-Id: Ia5d8cfb746d689b1f4750e79721419d02ae7db70 +--- + src/mount/readahead_adviser.h | 4 ++++ + src/mount/readdata_cache.h | 2 +- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/mount/readahead_adviser.h b/src/mount/readahead_adviser.h +index 1dc89eae..832be05b 100644 +--- a/src/mount/readahead_adviser.h ++++ b/src/mount/readahead_adviser.h +@@ -54,6 +54,10 @@ public: + * \param size size of read operation + */ + void feed(uint64_t offset, uint32_t size) { ++ if (timeout_ms_ == 0) { ++ window_ = 0; ++ return; ++ } + addToHistory(size); + if (offset == current_offset_) { + random_candidates_ = 0; +diff --git a/src/mount/readdata_cache.h b/src/mount/readdata_cache.h +index 37f56e50..717826b6 100644 +--- a/src/mount/readdata_cache.h ++++ b/src/mount/readdata_cache.h +@@ -61,7 +61,7 @@ public: + } + + bool expired(uint32_t expiration_time) const { +- return timer.elapsed_ms() > expiration_time; ++ return timer.elapsed_ms() >= expiration_time; + } + + Offset endOffset() const { +-- +2.13.0 + diff --git a/lizardfs.spec b/lizardfs.spec index 7761a3d..76c433d 100644 --- a/lizardfs.spec +++ b/lizardfs.spec @@ -1,7 +1,7 @@ Name: lizardfs Summary: Distributed, fault tolerant file system -Version: 3.11.0 -Release: 3%{?dist} +Version: 3.11.2 +Release: 1%{?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,16 +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 -# Upstream patch that adds missing destructor to direntry cache -Patch5: 0001-mount-Add-missing-destructor-to-direntry-cache.patch -# Upstream patch that fixes dangling nodes that cause master to crash -Patch6: 0001-master-Fix-dangling-nodes-in-defective-files-list.patch +# Upstream patch to fix problems reporting defective files +Patch2: 0001-master-Fix-issues-with-reporting-defective-files.patch +# Upstream patch to fix request size in cache when results are empty +Patch3: 0002-mount-Fix-request-size-in-read-cache-for-empty-resul.patch +# Upstream patch to fix read request size when readahead is disabled +Patch4: 0003-mount-Fix-read-request-size-with-disabled-readahead.patch BuildRequires: fuse-devel BuildRequires: cmake BuildRequires: pkgconfig @@ -420,6 +416,10 @@ install -m644 %{SOURCE2} %{buildroot}%{_sysconfdir}/security/limits.d/95-lizardf %changelog +* Wed Jul 5 2017 Jonathan Dieter - 3.11.2-1 +- Update to 3.11.2, removing upstreamed patches and adding in some new ones to + fix some small caching bugs + * Sun May 28 2017 Jonathan Dieter - 3.11.0-3 - Add more upstream bug-fixes, the most important of which fixes a rare crash in master diff --git a/sources b/sources index 41ed632..978e263 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (lizardfs-3.11.0.tar.gz) = 39fb758354371cf9da82602c69f4368e44511ccda49e0f81527036ed5013b05d2048ac1b66d11ca22fb7f3d48ebdc49f1fc53881e94c45db7af784555bd438be +SHA512 (lizardfs-3.11.2.tar.gz) = af29abd395a684c45a33094010759b8d39c9d77de73b64c5933ebb182a97d07e8f7c67429f0a9e83a8c631b09370272c7fd51302944b682e9e54a32f9eb27434