From: Yan, Zheng Date: Fri, 28 Nov 2014 08:12:06 +0000 (+0800) Subject: mds: don't trim log when MDS is readonly X-Git-Tag: v0.91~52^2~14^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2d4a746fa9146fea78274d6fdb2f6ef448da608b;p=ceph.git 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 --- diff --git a/src/mds/MDLog.cc b/src/mds/MDLog.cc index 456e97d551c7..97d105a27913 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);