]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: disallow flush dentry/journal when MDS is readonly 3038/head
authorYan, Zheng <zyan@redhat.com>
Fri, 5 Dec 2014 02:48:43 +0000 (10:48 +0800)
committerYan, Zheng <zyan@redhat.com>
Fri, 5 Dec 2014 02:49:07 +0000 (10:49 +0800)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/MDCache.cc
src/mds/MDS.cc

index 963b04fc0285218a9a8a8d668bcee2763f3860ea..da8bf2234eeee05ddb90e7a3b2445e6e81006a19 100644 (file)
@@ -11599,6 +11599,11 @@ void MDCache::scrub_dentry_work(MDRequestRef& mdr)
 
 void MDCache::flush_dentry(const string& path, Context *fin)
 {
+  if (is_readonly()) {
+    dout(10) << __func__ << ": read-only FS" << dendl;
+    fin->complete(-EROFS);
+    return;
+  }
   dout(10) << "flush_dentry " << path << dendl;
   MDRequestRef mdr = request_start_internal(CEPH_MDS_OP_FLUSH);
   filepath fp(path.c_str());
index 9008193a493a9d8159592f4ece998746c6439050..ea8d23da0556280db490cfd465ccefd307a41b7e 100644 (file)
@@ -365,6 +365,11 @@ int MDS::_command_flush_journal(std::stringstream *ss)
 
   Mutex::Locker l(mds_lock);
 
+  if (mdcache->is_readonly()) {
+    dout(5) << __func__ << ": read-only FS" << dendl;
+    return -EROFS;
+  }
+
   // I need to seal off the current segment, and then mark all previous segments
   // for expiry
   mdlog->start_new_segment();