!243 [sync] PR-238: mon: fix mds metadata lost in one case

From: @openeuler-sync-bot 
Reviewed-by: @liuqinfei 
Signed-off-by: @liuqinfei
This commit is contained in:
openeuler-ci-bot 2024-04-17 01:24:33 +00:00 committed by Gitee
commit 3cc36d71da
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From 56cbf3f0716b556c815487d719abe86021125925 Mon Sep 17 00:00:00 2001
From: shimin <shimin@kuaishou.com>
Date: Wed, 10 Apr 2024 09:10:04 +0800
Subject: [PATCH] mon:fix mds metadata lost in one case
In most cases, peon's pending_metadata is inconsistent with mon's db.
When a peon turns into leader, and at the same time a active mds stops,
the new leader may flush wrong mds metadata into db. So we meed to
update mds metadata from db at every fsmap change.
This phenomenon can be reproduce like this:
A Cluster with 3 mon and 3 mds (one active, other two standby), 6 osd.
step 1. stop two standby mds;
step 2. restart all mon; (make pending_medata consistent with db)
step 3. start other two mds
step 4. stop leader mon
step 5. run "ceph mds metadata" command to check mds metadata
step 6. stop active mds
step 7. run "ceph mds metadata" command to check mds metadata again
In step 7, we would find mds metadata lost.
Fixes: https://tracker.ceph.com/issues/63166
Signed-off-by: shimin <shimin@kuaishou.com>
---
src/mon/MDSMonitor.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc
index 4b27d828c..0ac5060f7 100644
--- a/src/mon/MDSMonitor.cc
+++ b/src/mon/MDSMonitor.cc
@@ -136,6 +136,7 @@ void MDSMonitor::update_from_paxos(bool *need_bootstrap)
<< ", my e " << get_fsmap().epoch << dendl;
ceph_assert(version > get_fsmap().epoch);
+ load_metadata(pending_metadata);
load_health();
// read and decode
--
2.27.0

View File

@ -174,7 +174,7 @@
#################################################################################
Name: ceph
Version: 18.2.2
Release: 2
Release: 3
%if 0%{?fedora} || 0%{?rhel} || 0%{?openEuler}
Epoch: 2
%endif
@ -195,6 +195,7 @@ Source0: %{?_remote_tarball_prefix}ceph-18.2.2.tar.gz
Patch1: 0001-modify-xsimd-source-to-local-and-set-cxx17-for-arrow.patch
Patch2: 0002-fix-compilation-with-cython3.patch
Patch3: 0003-fix-CVE-2023-46159.patch
Patch4: 0004-fix-mds-metadata-lost-in-one-case.patch
%if 0%{?suse_version}
# _insert_obs_source_lines_here
@ -2632,6 +2633,9 @@ exit 0
%{_datadir}/snmp/mibs
%changelog
* Wed Apr 10 2024 cenhuilin <cenhuilin@kylinos.cn> - 2:18.2.2-3
- mon: fix mds metadata lost in one case
* Fri Mar 22 2024 lizhipeng <qiuxinyidian@gmail.com> - 2:18.2.2-2
- fix CVE-2023-46159