From efcc49de79cac0724568df8192be0c104bbebdf5 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Thu, 16 Jan 2020 17:45:21 +0800 Subject: [PATCH] mds: don't respond getattr with -EROFS when mds is readonly Fixes: https://tracker.ceph.com/issues/43601 Signed-off-by: "Yan, Zheng" --- src/mds/Server.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 35da262d408..da11f9d7d86 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -2435,12 +2435,16 @@ void Server::dispatch_client_request(MDRequestRef& mdr) dout(7) << "dispatch_client_request " << *req << dendl; - if (mdcache->is_readonly() || - (mdr->has_more() && mdr->more()->slave_error == -EROFS)) { + if (req->may_write() && mdcache->is_readonly()) { dout(10) << " read-only FS" << dendl; respond_to_request(mdr, -EROFS); return; } + if (mdr->has_more() && mdr->more()->slave_error) { + dout(10) << " got error from slaves" << dendl; + respond_to_request(mdr, mdr->more()->slave_error); + return; + } if (is_full) { if (req->get_op() == CEPH_MDS_OP_SETLAYOUT || -- 2.39.5