From: Yan, Zheng Date: Fri, 5 Dec 2014 02:48:43 +0000 (+0800) Subject: mds: disallow flush dentry/journal when MDS is readonly X-Git-Tag: v0.91~52^2~14^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F3038%2Fhead;p=ceph.git mds: disallow flush dentry/journal when MDS is readonly Signed-off-by: Yan, Zheng --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 963b04fc02852..da8bf2234eeee 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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()); diff --git a/src/mds/MDS.cc b/src/mds/MDS.cc index 9008193a493a9..ea8d23da05562 100644 --- a/src/mds/MDS.cc +++ b/src/mds/MDS.cc @@ -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();