Add more upstream bug-fixes, the most important of which fixes a rare

crash in master

Signed-off-by: Jonathan Dieter <jdieter@lesbg.com>
This commit is contained in:
Jonathan Dieter 2017-05-28 21:25:44 +03:00
parent 27425a82e0
commit 41f3fb9c59
3 changed files with 121 additions and 1 deletions

View File

@ -0,0 +1,77 @@
From dad26eef2cf1a4570a87a74e7a4cbf1823b86073 Mon Sep 17 00:00:00 2001
From: Hazeman <hazeman@skytechnology.pl>
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<FSNode>(entry.first);
+ if (!node) {
+ continue;
+ }
+
if (node->type == FSNode::kFile || node->type == FSNode::kTrash ||
node->type == FSNode::kReserved) {
FSNodeFile *file_node = static_cast<FSNodeFile *>(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

View File

@ -0,0 +1,35 @@
From c47ad770036f84c136f28b4f80cfed425b9d973b Mon Sep 17 00:00:00 2001
From: Piotr Sarna <sarna@skytechnology.pl>
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

View File

@ -1,7 +1,7 @@
Name: lizardfs
Summary: Distributed, fault tolerant file system
Version: 3.11.0
Release: 2%{?dist}
Release: 3%{?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
@ -19,6 +19,10 @@ Patch2: 0001-master-Fix-high-cpu-usage-in-fs_periodic_file_test.patch
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
BuildRequires: fuse-devel
BuildRequires: cmake
BuildRequires: pkgconfig
@ -416,6 +420,10 @@ install -m644 %{SOURCE2} %{buildroot}%{_sysconfdir}/security/limits.d/95-lizardf
%changelog
* Sun May 28 2017 Jonathan Dieter <jdieter@lesbg.com> - 3.11.0-3
- Add more upstream bug-fixes, the most important of which fixes a rare crash
in master
* 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