From 2d4a746fa9146fea78274d6fdb2f6ef448da608b Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Fri, 28 Nov 2014 16:12:06 +0800 Subject: [PATCH] mds: don't trim log when MDS is readonly When MDS is readonly, keep metadata objects (not include the journal) of cephfs unchanged. This allows us to submit new entries to the log while MDS is readonly. (Log entries submitted after MDS becomes readonly can be safely dropped) Signed-off-by: Yan, Zheng --- src/mds/MDLog.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mds/MDLog.cc b/src/mds/MDLog.cc index 456e97d551c..97d105a2791 100644 --- a/src/mds/MDLog.cc +++ b/src/mds/MDLog.cc @@ -489,6 +489,11 @@ void MDLog::trim(int m) if (m >= 0) max_events = m; + if (mds->mdcache->is_readonly()) { + dout(10) << "trim, ignoring read-only FS" << dendl; + return; + } + submit_mutex.Lock(); // trim! @@ -638,6 +643,11 @@ void MDLog::try_expire(LogSegment *ls, int op_prio) void MDLog::_maybe_expired(LogSegment *ls, int op_prio) { + if (mds->mdcache->is_readonly()) { + dout(10) << "_maybe_expired, ignoring read-only FS" << dendl; + return; + } + dout(10) << "_maybe_expired segment " << ls->seq << "/" << ls->offset << ", " << ls->num_events << " events" << dendl; try_expire(ls, op_prio); -- 2.47.3