]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: don't trim log when MDS is readonly
authorYan, Zheng <zyan@redhat.com>
Fri, 28 Nov 2014 08:12:06 +0000 (16:12 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 2 Dec 2014 02:47:23 +0000 (10:47 +0800)
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 <zyan@redhat.com>
src/mds/MDLog.cc

index 456e97d551c76dcb7713160ab329bb08af214001..97d105a27913e3672efcf833d283b30e9c1d9d2f 100644 (file)
@@ -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);