From: Patrick Donnelly Date: Wed, 24 Mar 2021 20:54:17 +0000 (-0700) Subject: mds: reject lookup ino requests for mds dirs X-Git-Tag: v16.2.5~33^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=48268b5961c0078e5d99db5ef76824b527cab125;p=ceph.git mds: reject lookup ino requests for mds dirs Fixes: https://tracker.ceph.com/issues/49922 Signed-off-by: Patrick Donnelly (cherry picked from commit 682a55e8a22a137f80855f2cdd98f6f230d67fce) --- diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 22750c2fb75..30425d47cf8 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -3908,6 +3908,19 @@ void Server::handle_client_lookup_ino(MDRequestRef& mdr, return _lookup_snap_ino(mdr); inodeno_t ino = req->get_filepath().get_ino(); + auto _ino = ino.val; + + /* It's been observed [1] that a client may lookup a private ~mdsdir inode. + * I do not have an explanation for how that happened organically but this + * check will ensure that the client can no longer do that. + * + * [1] https://tracker.ceph.com/issues/49922 + */ + if (_ino < MDS_INO_SYSTEM_BASE && _ino != MDS_INO_ROOT) { + respond_to_request(mdr, -CEPHFS_ESTALE); + return; + } + CInode *in = mdcache->get_inode(ino); if (in && in->state_test(CInode::STATE_PURGING)) { respond_to_request(mdr, -CEPHFS_ESTALE);